Downloading blob will save the file by the procedure name and not the actual file name
From: Ahmad <amabsout_at_yahoo.com>
Date: Sun, 5 Oct 2003 14:03:44 +0400
Message-ID: <bloqdg$5915_at_news-dxb.emirates.net.ae>
Hi,
END IF;
/*********** Determines the mime type for the document to be displayed***********/
EXCEPTION
when others then
htp.p(sqlerrm);
END; Received on Sun Oct 05 2003 - 12:03:44 CEST
Date: Sun, 5 Oct 2003 14:03:44 +0400
Message-ID: <bloqdg$5915_at_news-dxb.emirates.net.ae>
Hi,
I am using PL/SQL web toolkit to open documents in a browser. The documents are stored as BLOB data types. I am using the below procedure "viewer.sql" to open the documents based on the mime types.
My question: When I try to save the opened document, I see that the file
name is
that of the procedure name in the URL and not the actual filename.
I have the filename stored in the database. Is there a way to change the filename?
Actual code....
CREATE OR REPLACE PROCEDURE VIEWER (DOC_LOC IN NUMBER,D_ID IN NUMBER) AS
V_file_ext VARCHAR2(5)
V_blob BLOB;
buffer raw(32767);
buffer_size integer := 32767;
offset integer := 1;
length number;
BEGIN THEN
BEGIN SELECT FILE_EXT,ATTACHMENT INTO V_file_ext,V_blob FROM RBCMS_INBOX WHERE MAIL_ID= D_ID; EXCEPTION WHEN NO_DATA_FOUND THEN htp.p('Documents not found'); END; ELSIF doc_loc = 2 THEN BEGIN SELECT DOC_EXT,DOCUMENT INTO V_file_ext,V_blob FROM RBCMS_DOCUMENTS WHERE DOC_ID = D_ID; EXCEPTION WHEN NO_DATA_FOUND THEN htp.p('Documents not found'); END; ELSE NULL;
END IF;
/*********** Determines the mime type for the document to be displayed***********/
IF UPPER(V_FILE_EXT)='PDF' THEN owa_util.mime_header('application/pdf'); ELSIF UPPER(V_FILE_EXT)='DOC' THEN owa_util.mime_header('application/msword'); ELSIF UPPER(V_FILE_EXT)='XLS' THEN owa_util.mime_header('application/msexcel'); ELSIF UPPER(V_FILE_EXT)='GIF' THEN owa_util.mime_header('image/gif'); ELSIF UPPER(V_FILE_EXT)='JPG' THEN owa_util.mime_header('image/jpeg'); ELSIF UPPER(V_FILE_EXT)='TIF' THEN owa_util.mime_header('image/tiff'); ELSE null; --owa_util.mime_header('text/plain'); END IF; length := dbms_lob.getlength(v_blob); while offset < length loop dbms_lob.read(v_blob, buffer_size, offset, buffer); htp.prn(utl_raw.cast_to_varchar2(buffer)); offset := offset + buffer_size; end loop; IF length = 0 THEN htp.p('Documents Not Available'); END IF;
EXCEPTION
when others then
htp.p(sqlerrm);
END; Received on Sun Oct 05 2003 - 12:03:44 CEST