Download apacle apex file

I want to change the way APEX files are uploaded. I do not want the files to fall into the database tables as a BLOB. Instead, I want me to get the right to the OS directory on the machine where apex is running. Is it possible? If so, where do I need to start?

+6
source share
3 answers

The file viewer is always loaded in the BLOB column. If not in the specified table, it will go to wwv_flow_files ( apex_application_files ), which is an alternative option. This should not be an intruder, as you can easily clean the table after completing the BLOB processing.

  • Identify the place where your files should end up
  • Make sure you have the necessary permissions! (read, write ...)
  • Create a directory object in the database that references this location: CREATE DIRECTORY statement documentation
  • Make sure you have the necessary grants for this facility (read, write, ...)
  • Create a procedure that will write the BLOB to the file. An example of this technique is here (dba-oracle.com) . In short, what this will do:

    • open the file in the file system (a directory is required, and the directory is called the name of the directory object that you
      created earlier!)

       -- define output directory l_output := utl_file.fopen('DIR_TEMP', 'filename','wb', 32760); 

      In this code example, the created directory is a DIR_TEMP object

    • take a drop
    • read about it
    • write this piece to the file system
    • repeat the last 2 steps until the end of the BLOB is reached (if the BLOB not small enough so that it can be written in one go)
    • set the file view item to upload to wwv_flow_files
    • close the file (finish it)
  • You can then modify this procedure to get a BLOB as in the IN parameter.
  • In apex, create plsql process after submit. You can call the file recording procedure there by providing it with a saved blob object.
  • And clear the loading table.

Vertex process example:

 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 additional documentation, there is always google, Oracle documentation for all the objects used here, or even Oracle forums (for example, OTN apex forums or OTN PL / SQL forums ).

+5
source
 declare v_length number; v_id number; begin select doc_size into v_length from wwv_flow_files where name = :P105_PIC; if v_length > 20000 then delete from wwv_flow_files where name = :P105_PIC; commit; apex_error.add_error ( p_message => 'Cannot upload pictures bigger than 20kB!', p_display_location => apex_error.c_inline_in_notification ); end if; exception when others then apex_error.add_error ( p_message => 'Cannot upload pictures!', p_display_location => apex_error.c_inline_in_notification ); end; 
0
source

after saving the file to disk (say, a PDF file) I want to open this PDF file with the click of a button. How can i do this?

0
source

Source: https://habr.com/ru/post/1437815/


All Articles