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!

Problem of downloading a file in Apex 5.1

vimanMar 31 2017 — edited Apr 4 2017

I need to implement downloading a file from the page when I go to it.
On the page, the process is implemented in "Pre-Rendering" - "Before Header", but the recommended technique for implementing the file download does not work. The contents of the file are displayed on the page as an inline instead of downloading the file. I read about the problem of HTTP headers (mime) in version 5 of Apex and applied the recommendations in the code. But this does not work:
   
Sys.htp.flush;
   
Sys.htp.init;
   
Sys.owa_util.mime_header ('application/octet-stream', FALSE, 'UTF-8');
   
Sys.htp.p ('Content-length:' || sys.dbms_lob.getlength (v_file_body));
   
Sys.htp.p ('Content-Disposition: attachment; filename = "FILENAME.TXT"');
   
Sys.owa_util.http_header_close;
   
Wpg_docload.download_file (v_file_body);

Where "v_file_body" is a blob. In Apex 4.2, this technique worked fine and without the recommended "sys.htp.flush; sys.htp.init" for version 5. What am I doing wrong?
P.S: Sorry for the google translation ...

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 2 2017
Added on Mar 31 2017
4 comments
3,025 views