14 Replies Latest reply: Oct 21, 2013 9:50 PM by Vishal Pathak (OBIEE-APEX) RSS

    custom download procedure not working

    Gor_Mahia

      Hi,

       

      I have created a custom download procedure to download uploaded files from custom table records which are displayed via links and i call my procedure as #OWNER#.my_file?p_file=#ID#. Now the problem this procedure call works in my development system not any other system. What i am i missing here? is there any grant i need to provide but i don't want to grant to public also

       

      apex 4.1.1

       

       

      create or replace PROCEDURE my_file(p_file in number) AS

              v_mime  VARCHAR2(500);

              v_length  NUMBER;

              v_file_name VARCHAR2(400);

              Lob_loc  BLOB;

      BEGIN

          SELECT trim(MIME_TYPE), BLOB_CONTENT, trim(filename),DBMS_LOB.GETLENGTH(blob_content)

                      INTO v_mime,lob_loc,v_file_name,v_length

                      FROM EMP.FILE_attachments

                      WHERE id = p_file;

                          owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );

                      htp.p('Content-length: ' || v_length);

                      htp.p('Content-Disposition:  attachment; filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');        

                      owa_util.http_header_close;

                      wpg_docload.download_file( Lob_loc );

      -------------------------------------------------------------------------------

      thanks,