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!

view document downloaded from object storage inline in browser

DaudJan 16 2025

I am trying to display a file that is downloaded from oracle object storage inline in browser window instead of downloading it to a drive. I commented out the last few lines of the code that I got from livelab and replace it with a call to apex_http.download. See below. However, when I run it I got an error “ora-20987 the requested url has been prohibited. contact your administrator”. Anybody knows what I need to do to fix this? Is this possible or not?

I have actually tested the download part - it works fine. I just want it to display the file inline in the browser now.

=======some code======

    l\_response := apex\_web\_service.make\_rest\_request\_b(  
       p\_url => l\_request\_url  
       , p\_http\_method => 'GET'  
       , p\_credential\_static\_id => :G\_OCI\_WEB\_CREDENTIAL  
   );

   if apex\_web\_service.g\_status\_code != 200 then  
       raise download\_failed\_exception;  
   end if;

   for i in 1..apex\_web\_service.g\_headers.count  
   loop  
       if apex\_web\_service.g\_headers(i).name = 'Content-Length' then  
           l\_content\_length := apex\_web\_service.g\_headers(i).value;  
       end if;

       if apex\_web\_service.g\_headers(i).name = 'Content-Type' then  
           l\_content\_type := apex\_web\_service.g\_headers(i).value;  
       end if;  
   end loop;  


    /\*  
   sys.htp.init;  
   if l\_content\_type is not null then  
       sys.owa\_util.mime\_header(trim(l\_content\_type), false);  
   end if;  
   sys.htp.p('Content-length: ' || l\_content\_length);  
   sys.htp.p('Content-Disposition: attachment; filename="'          
       || document.file\_name || '"' );  
   sys.owa\_util.http\_header\_close;  
   sys.wpg\_docload.download\_file(l\_response);    
   \*/

   --// display the file inline in the browser window  
   apex\_http.download(  
       p\_blob          => l\_response,  
       p\_content\_type  => l\_content\_type,  
       p\_filename      => document.file\_name,  
       p\_is\_inline     => true  
   );
Comments
Post Details
Added on Jan 16 2025
0 comments
476 views