Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Download multiple files from urls to client disk

DejanDOct 16 2018 — edited Oct 16 2018

After searching for days, I am stuck on how to do this. The functionality I ultimately need is this:


I have a table with URLs to files. The user wants to have checkboxes (interactive report) where he will check the files he wants to download to the disk, press a download button and the files need to be downloaded.

I have tried doing this with javascript (chrome just opens the docs in tabs), ajax (cors issues) etc. So now I am trying to do it with PL/SQL. Here is a test procedure I made to try to first download blobs from a table.

begin

    for i in (select doc, mimetype, filename, url from document)

    loop

      sys.htp.init;

      sys.owa_util.mime_header( i.mimetype , false );

      sys.htp.p('Content-Disposition: attachment; filename="' || i.filename ||'"');

      sys.htp.p('Content-length: ' || sys.dbms_lob.getlength( i.doc ));

      sys.owa_util.http_header_close;

      sys.wpg_docload.download_file(i.doc);

    

      -- Stop page processing

      apex_application.stop_apex_engine;             

    end loop;

end;

This obviously doesn't work as the apex_application.stop_apex_engine command halts the procedure after the first iteration. If I ommit this command, nothing happens.

Does anybody have a solution to this problem, or know of a good way to download multiple files from a server (preferably not using zip)?

This post has been answered by askMax - Maxime Tremblay on Oct 16 2018
Jump to Answer
Comments
Post Details
Added on Oct 16 2018
6 comments
667 views