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!

Internal server error after wpg_docload.download_file

583861Jun 19 2007 — edited Jun 25 2007
Hello,[PRE]
In apex v. 2.1 after running this procedure:
create or replace procedure download_my_file(cislo_prilohy In Number) As
    v_length    Number;
    v_file_name Varchar2(2000);
    Lob_loc     Bfile;
  
  Begin
    Select filename
      Into v_file_name
      From PRIL
     Where cisloprilohy = cislo_prilohy;
  
    Lob_loc  := bfilename('PRILOHY', v_file_name);]
    v_length := dbms_lob.getlength(Lob_loc);]
  
    owa_util.mime_header('application/octet', False);]
    htp.p('Content-length: ' || v_length);]
    htp.p('Content-Disposition: attachment; filename="' || SUBSTR(v_file_name, INSTR(v_file_name, '/') + 1) || '"'); 
    owa_util.http_header_close;]
    wpg_docload.download_file(Lob_loc);]
   
  End download_my_file;]
/

I got window "Download file" with correct filename and size,but after I saved or opened the file, there was only:

HTTP/1.1 500 Internal Server Error

Server: Oracle XML DB/Oracle Database

Content-Type: application/octet

Content-Length: 4056367

Content-Disposition: attachment; filename="nikon.pdf"



<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>500 Internal Server Error</TITLE>
</HEAD><BODY><H1>Internal Server Error</H1>
</BODY></HTML>

inside the file.

Here are my steps:

1) I created directory object 'PRILOHY' and granted read permissions on them.

2) I created table PRIL (CISLOPRILOHY NUMBER,FLOB BFILE,FILENAME Varchar2, CISLOPASPORTU NUMBER)

3) I inserted row into the table:

insert into PRIL (FLOB,FILENAME,CISLOPASPORTU)
values (BFILENAME('PRILOHY','nikon.pdf'),'nikon.pdf',201);

4) I created procedure download_my_file.

5) I run procedure from apex process.

Any ideas, what's wrong?

Thank you

Zdenek                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 23 2007
Added on Jun 19 2007
4 comments
923 views