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