I want to change the way APEX uploads files. I don't want files get into database tables as a BLOB. Instead, I want'em to get right to OS directory on the machine where apex is running. Is it possible? If so, what do I need to start with?
The file browse item will always upload to a BLOB
column. If not in a specified table, it'll go to wwv_flow_files
(apex_application_files
) which is the alternate option. That shouldn't be a dealbreaker though as you can easily clean up the table after you finish processing the BLOB
.
Create a procedure that will write a BLOB
to a file. An example of this
technique is here (dba-oracle.com). In short, what that will do
is:
open up a file on the filesystem (a directory is required, and a directory is referred to by the name of the directory object you
created earlier!)
-- define output directory
l_output := utl_file.fopen('DIR_TEMP', 'filename','wb', 32760);
In this example code, the created directory is the DIR_TEMP
object
BLOB
is small enough to be written in 1 go)wwv_flow_files
BLOB
as in IN
parameter.Example apex process:
DECLARE
v_upl_blob BLOB;
BEGIN
SELECT blob_content
INTO v_upl_blob
FROM wwv_flow_files
WHERE name = :Px_FILE_BROWSE_ITEM;
my_file_write_procedure(v_upl_blob);
DELETE FROM wwv_flow_files
WHERE name = :Px_FILE_BROWSE_ITEM;
END;
For even more documentation, there is of course always google, the oracle documentation on all objects used here, or even the oracle forums (OTN apex forums or OTN PL/SQL forums for example)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With