file upload & download pl/sql server pages [message #640130] |
Wed, 22 July 2015 23:22  |
 |
prempal
Messages: 4 Registered: July 2015 Location: INDIA
|
Junior Member |
|
|
I want to upload pdf file in to oracle web server and downlaod the same pdf at client side (web server).
1. I am uploading the file but file is getting stored in binary code ,
2. I want to download the same file in same format as it was uploaded i.e., pdf/doc/excel.
i am trying to use this code
procedure---Write upload data .....
CREATE OR REPLACE procedure OCMSDEV.write_info (who in varchar2, description in varchar2,file in varchar2)
as
p number;
begin
select max(pid) into p from mytable;
p:=p+1;
insert into myTable(pid,WHO,DESCRIPTION,file1)
values (p,who,description,utl_raw.cast_to_raw('file'));
htp.htmlopen;
htp.headopen;
htp.title('File Uploaded');
htp.headclose;
htp.bodyopen;
htp.header(1, 'Upload Status');
htp.print('Uploaded ' || 'ID :'|| p || ' successfully');
htp.bodyclose;
htp.htmlclose;
end;
/
procedure for downloading images-----....
CREATE OR REPLACE PROCEDURE Display_Image(p_id NUMBER) IS
Photo BLOB;
a NUMBER:= 4096;
v_off NUMBER:= 1;
v_raw RAW(4096);
BEGIN
SELECT file1
INTO Photo
FROM mytable
WHERE pid = p_id;
owa_util.mime_header('images/gif');
BEGIN
LOOP
-- Read the BLOB
dbms_lob.READ(Photo, a, v_off, v_raw);
-- Display image
htp.prn(utl_raw.cast_to_varchar2(v_raw));
v_off := v_off + a;
a := 4096;
END LOOP;
dbms_lob.CLOSE(Photo);
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
END;
END;
/
kindly suggest me solution for uploading and downloading file into/from server pages PSP
|
|
|
|
|
|
|
|