joe
joe

Reputation: 41

How to create a column table that holds a file in Oracle Apex

I have created a report with a form in Oracle Apex, for this report I am using a table that have 5 columns and 1 of the columns is filename varchar2(500) which is support to hold a file. In the form I have a page item that uploads the file, however when I create a new record in the form, that records is added without the file uploaded.

Any ideas on how to achieve this process correctly? I am sure my table column is the problem, however I do not know how to fix it.

Upvotes: 0

Views: 1057

Answers (3)

TineO
TineO

Reputation: 1033

As others have pointed out, you need to create a table with a BLOB column in which the file will be held.

In order to get it there though, uploading straight to a table is complicated, so what is usually the standard is to set the File Upload item to upload to apex_application_files which is the default table for such things. Then the second process that runs after that takes the name from :Pxx_FILE_UPLOAD_ITEM and uses that to select on the apex_application_files table and then inserts the selected blob into your actual table.

Because apex_application_files you actually cant really access from the DB, only through apex(you probably could, but it would be complicated and I havent yet).

Upvotes: 1

Koen Lostrie
Koen Lostrie

Reputation: 18665

Your file itself is in a column of datatype BLOB since that is binary data, but you need more columns. Check the sample app called "Sample File Upload and Download" which has a complete example with instructions on how to do this, there are also plenty of blogs around that explain the details.

Upvotes: 1

Littlefoot
Littlefoot

Reputation: 142733

If "file" you mention is e.g. a JPG picture, a PDF file and something like that, then you should create that column as a BLOB.

Upvotes: 0

Related Questions