1. Page Design
Page A has several region, one region for file list management (contains display, download. Delete). A.
In page A There is a button, click it will invoke page B, page B is responsible for file upload. B.
Figure A
Figure B
2. database table Design
File |
FILE_ID number, File_desc VARCHAR2 (256), CONTENT Blob, Mime_type VARCHAR2 (256), Char_set VARCHAR2 (256), Last_update date, file_name VARCHAR2 (256) |
3. Apex Implementation 3.1 Gets the list of uploaded files in page A to create a classic report region, the region source is
Select f.file_id, F.file_desc, F.file_name, Dbms_lob.getlength ("File_content") as File_content, Mime_type, Char_set, Last_update, ' <a href= ' javascript: $s (' p530_delete_file ', ' ' | | f.file_id | | ‘‘‘);" >Delete</a> ' as Delete_file From FILE F |
Note: Because blobs cannot be mapped directly into page elements, the Dbms_lob.getlength function is used to get the size of the BLOB as a placeholder.
In the Report Attribute tab, click File_content to enter the Cloumn setting: 1. Number/date format Select Blob;2. Format mask:download;3. Blob table:file4. Blob column:file_content5. Primary Key Column 1:file_id;6. Mimetype column:mime_type;7. FIlename column:file_name;8. Last Updated column:last_update;9. Character Set column:char_set;10. Download Text:download
3.2 Page B uploading a file using page B as a separate page upload one reason is that apex cannot create multiple form on a table in a single page, in other words, a page of apex can only create a form on a table. The advantage of creating a form on a table page is that apex helps us manage the insertion of the table. The details of the update. So the creation of page B is simply to create a form with Apex on a Table wizard step-by-step.
When you change the file_content corresponding item. Display as: Select File brows in its setting tag, 1. Storage type:blob column specified in Item Source attribute;2. Mimetype column:mime_type;3. FIlename column:file_name;4. Last Updated column:last_update;5. Character Set Column:char_set;
In the storage type, an option is table Wwv_flow_files, which is a table built into apex for file uploads. This is the approach of the apex old version number and is reserved for backwards compatibility. Assuming this option is selected, all file upload functions of different application will be sent to this table, I think this file management will be a bit confusing. tend to build their own database tables to manage.
Oracle Apex Useful Note Series 2-File Upload management