6 Replies Latest reply on Oct 16, 2018 5:58 PM by askMax

    Download multiple files from urls to client disk

    DejanD

      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)?