我用这样一个存储过程下载上传的附件,如下所示:
create or replace PROCEDURE download_mfg_file1(p_file in number) AS
v_mime VARCHAR2(48);
v_length NUMBER;
v_file_name VARCHAR2(2000);
Lob_loc BLOB;
BEGIN
SELECT MIME_TYPE,BLOB_CONTENT,name,DBMS_LOB.GETLENGTH(blob_content)
INTO v_mime,lob_loc,v_file_name,v_length
FROM MFG_UPLOADFILES
WHERE id = p_file;
--
-- set up HTTP header
--
--use an NVL around the mime type and
--if it is a null set it to application/octect
--application/octect may launch a download window from windows
owa_util.mime_header( nvl(v_mime,'application/octet'),FALSE);
--set the size so the browser knows how much to download htp.p('Content-length:'|| v_length);
--the filename will be used by the browser if the users does a save as
htp.p('Content-Disposition: attachment;filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)||'"');
--close the headers
owa_util.http_header_close;
--download the BLOB
wpg_docload.download_file(Lob_loc);
end download_mfg_file1;
上传的附件保存在数据库里并没有乱码问题,下载的时候,附件内容也没有问题,问题是附件的文件名变成乱码了.数据库的字符集是AL32UTF8,应用程序设置的是UTF-8.红色字体标记的部分,我看不明白是怎么去取这个文件名的符号'/'是做什么用的?因为保存在数据库里的v_file_name值里面只有'\'符号,没有'/'符号,它到底是怎么取得文件名的?英文的时候正常.哪位帮看看是什么原因?不胜感激!