Oracle Apex Utility Note Series 2-File Upload management

Source: Internet
Author: User

1. Page Design

Page A has several region, one region for file list management (including 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 insert, updated details of the table. So the creation of page B as soon as you create a form with Apex on a Table wizard step-by-step.
When modifying the file_content corresponding Item, display as: Select File brows in its setting tab, 1. Storage type:blob column specified in Item Source Attribu Te;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, the other option is table Wwv_flow_files, which is a built-in list for file uploads in apex. This is the approach of the apex old version, reserved for backwards compatibility. If you choose this option, 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 Utility Note Series 2-File Upload management

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.