Zip BLOB and Download with WPG_DOCLOAD.DOWNLOAD_FILE();

I am working with APEX 4.1
Within the application being developed, it is a requirement to be able to select multiple rows within an interactive report, then click a button to download these as a ZIP file.
Currently, a field is populated that contains a colon-delimited list of ID values to determine which rows to download, like ":17:127:"
Upon submitting the page files are chosen and zipped through a process, then downloaded through the same process.
Here is the PL/SQL process for zip and download:
declare
  g_zipped_blob blob;
  b_dl_file BLOB;
  v_filename VarChar(1000);
begin
for rec in ( select FILE_ID, FILENAME, FILE_BLOB
from DD_FILES
where instr(:P9_FILE_ID, ':' || FILE_ID || ':') > 0)
LOOP
  zip_blobs.add1file( g_zipped_blob, rec.FILENAME, rec.FILE_BLOB );
end loop;
  zip_blobs.finish_zip( g_zipped_blob );
  select sysdate into v_filename from dual;
  owa_util.mime_header( 'application/octet', false );
  htp.p('Content-length: ' || dbms_lob.getlength(g_zipped_blob));
  htp.p('Content-Disposition:  attachment; filename="'|| v_filename ||'.zip"');          
  owa_util.http_header_close;
  wpg_docload.download_file(g_zipped_blob);
--dbms_lob.freetemporary( g_zipped_blob);
end;add1file and finish_zip are stored procedures.
Currently upon pressing the button, nothing happens(but the page is submitted, nothing seems to happen), although when testing the process, it returns what appears to be a text version of the BLOB (within the SQL commands section of the SQL workshop).
Any reasons why this would be happening?
Edited by: 922142 on 21-Mar-2012 06:20

Perhaps this should be in another forum area? Am I mistaken?

Similar Messages

  • How to upload a PDF file, zip it and download the zipped file?

    Hi Experts,
    I have a requirement to upload a PDF file, convert that to a ZIP file and download it. If anyone has worked on this requirement, can you please guide me on this? Thanks.
    Avi

    Here you go.  Hope it helps.
    REPORT  zrich_0004.
    DATA: lt_data TYPE TABLE OF x255.
    DATA: ls_data LIKE LINE OF lt_data.
    DATA: lv_zip_content TYPE xstring.
    DATA: lv_size  TYPE i.
    DATA: lv_filename TYPE string.
    DATA: lv_path TYPE string.
    DATA: lv_fullpath TYPE string.
    DATA: lt_filetab TYPE TABLE OF file_table.
    DATA: ls_filetab LIKE LINE OF lt_filetab.
    DATA: lv_rc TYPE sy-subrc.
    DATA: lv_content TYPE xstring.
    DATA: lo_zip TYPE REF TO cl_abap_zip.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: p_up TYPE string DEFAULT 'C:\upload.pdf' .
    PARAMETERS: p_down TYPE string DEFAULT 'C:\download.zip' .
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_up.
      REFRESH lt_filetab. CLEAR ls_filetab.
      cl_gui_frontend_services=>file_open_dialog(
          CHANGING
            file_table              = lt_filetab
            rc                      = lv_rc
        EXCEPTIONS
          OTHERS                  = 5 ).
      READ TABLE lt_filetab INTO ls_filetab INDEX 1.
      IF sy-subrc = 0.
        p_up = ls_filetab-filename.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_down.
      CLEAR: lv_filename, lv_path, lv_fullpath.
      cl_gui_frontend_services=>file_save_dialog(
         CHANGING
           filename             = lv_filename
           path                 = lv_path
           fullpath             = lv_fullpath
         EXCEPTIONS
           OTHERS               = 4 ).
      p_down = lv_fullpath.
    START-OF-SELECTION.
      CREATE OBJECT lo_zip.
    * Read the data as a string
      cl_gui_frontend_services=>gui_upload(
        EXPORTING
          filename                = p_up
          filetype                = 'BIN'
        IMPORTING
          filelength = lv_size
        CHANGING
          data_tab                = lt_data
        EXCEPTIONS
          OTHERS                  = 19 ).
    * convert binary to xstring
      CLEAR lv_content .
      CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
        EXPORTING
          input_length = lv_size
        IMPORTING
          buffer       = lv_content
        TABLES
          binary_tab   = lt_data
        EXCEPTIONS
          failed       = 1
          OTHERS       = 2.
    * Get the file name of the uploaded file
      DATA: lv_upfilename TYPE string.
      DATA: lv_tmp TYPE char1024.
      DATA: lv_tmp_file TYPE char1024.
      lv_tmp = p_up.
      CALL FUNCTION 'STRING_REVERSE'
        EXPORTING
          string  = lv_tmp
          lang    = sy-langu
        IMPORTING
          rstring = lv_tmp.
      SPLIT lv_tmp AT '\' INTO lv_tmp_file lv_tmp.
      CALL FUNCTION 'STRING_REVERSE'
        EXPORTING
          string  = lv_tmp_file
          lang    = sy-langu
        IMPORTING
          rstring = lv_tmp_file.
      lv_upfilename = lv_tmp_file.
    * add to zip file.
      lo_zip->add( name = lv_upfilename content = lv_content ).
      lv_zip_content   = lo_zip->save( ).
    * Conver the xstring content to binary
      CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          buffer        = lv_zip_content
        IMPORTING
          output_length = lv_size
        TABLES
          binary_tab    = lt_data.
    * download
      cl_gui_frontend_services=>gui_download(
          EXPORTING
            bin_filesize = lv_size
            filename     = p_down
            filetype     = 'BIN'
          CHANGING
            data_tab     = lt_data
          EXCEPTIONS
            OTHERS       = 24 ).
    Regards,
    Rich Heilman

  • Trouble with wpg_docload.download_file - Donwload Files - Oracle Web App

    i appreciate too much for everyone who can help me.
    I've got a ERROR with my Oracle Web App. When i type the URL "http://mydomain.com/pls/docs" in my browser, got this error:
    --------------------------------BROWSER-----------------------------------------
    Estado de Descarga
    Descarga del archivo falló. ORA-01403: no data found. ORA-01403: no data found
    And the code that generates this error is:
    PROCEDURE LEP_DESCARGA_ARCHIVO IS
      lv_FilePath VARCHAR2(32000); lv_FileName VARCHAR2(32000);
    BEGIN
    lv_FilePath := SUBSTR(owa_util.get_cgi_env('PATH_INFO'),2);
    SELECT name INTO lv_FileName FROM table_file WHERE UPPER(name) like UPPER(lv_FilePath); wpg_docload.download_file(lv_FileName);
    EXCEPTION
    WHEN OTHERS THEN
    HTP.htmlopen; HTP.headopen; HTP.title('Archivo Descargado'); HTP.headclose; HTP.bodyopen; HTP.header(1, 'Estado de Descarga'); HTP.print('Descarga del archivo ' || lv_filePath || ' falló.'); HTP.print(SQLERRM); HTP.bodyclose; HTP.htmlclose;
    END LEP_DESCARGA_ARCHIVO;
    The problem is that Error shows too much information in the Error. LEP_DESCARGA_ARCHIVO is important for another process in my site. Where do i have to configure in Oracle in order to this Error does not appear??? I mean i do not want to get this Error if i type the URL:
    https://mydomain.com/pls/docs/servlets/index.html Error: Descarga del archivo servlets/index.html falló. ORA-01403: no data found
    h t t p s : / / m y d o m a i n . c o m / p l s / d o c s / Error: Descarga del archivo falló. ORA-01403: no data found
    h t t p s : / / m y d o m a i n . c o m / p l s /d o c s / s e r v l e t s/ Error: Descarga del archivo servlets/ falló. ORA-01403: no data found
    Thanks for people who can help me!!!

    Hello Peter,
    I'm not sure whether this is a listener related problem, but we should try to find out.
    I have examples where a temporary blob is created first before the content is passed to WPG_DOCLOAD, which produce a working download on the APEX Listener.
    So I don't think the problem concerns WPG_DOCLOAD but the way you handle your blob, or to be precise, your BFILE.
    What comes to my mind first: Don't you need to open that file? When I use DMBS_LOB.LOADBLOBFROMFILE, I guess this is done somewhere inside that routine, but for other kinds of bfile access, there is DBMS_LOB.FILEOPEN.
    When thinking of that part: If I'm not completely wrong, there is a difference in which db user is acutally executing, or in other words, on whose behalf your code is executed, when you create a temporary blob first and forward it to wpg_docload or have wpg_docload do the file access. The Null Pointer Exception may result from either the file not being existent or not accessible for the db user executing the code. In case of wpg_docload accessing the file, perhaps the user you configured your APEX Listener to connect with needs additional grants for that file access.
    Just a thought. It should be easy to test the same scenario with using a temporary file on APEX Listener to see if that works and start debugging from there.
    -Udo

  • I can't access itune store not matter what I do. I have uninstalled the program twice and downloaded with no resolve.

    I am having difficulty accessing ITUNE STORE. The home screen for that page is blank. I have tried to uninstall and download twice and nothing changes. Everything else seems to be working with the program except accessing the store.

    Problems connecting to the iTunes Store often are due to firewalls, Internet privacy filters, and similar utilities blocking the connection. Run the Network Diagnostics in iTunes:
    http://support.apple.com/kb/HT3204
    and post the results here. That may provide some clues.
    Regards.

  • File Upload and Download with XSQL Utility

    Dear all,
    I'm working on a Web-based application to communicate with users.
    This application is based on the XSQL-Utility (XSU).
    Currently I cannot find any possibility to pass an arbitrary
    binary file from the client side to store it in a LOB column
    inside the Oracle RDBMS and vice versa.
    All examples I can find refers to store/read XML-content in CLOB
    columns.
    Thank you for any help.
    Stephan

    Hai Noufal,
        I successfully upload the files to the database.
        For file download i create two views.
       In the first view files are fetched from the database(datatype for the file is image in the database)and it is converted to byte from image.Afterthat the byte is converted to string by using the following code.
    byte source[]=new byte[1024];
                        if(rs.next()){
                             source=rs.getBytes("cv_document_file");
                        String sourcestr=source.toString();
                        wdContext.currentContextElement().setDownloadfile(sourcestr);     
            Now i put the converted string into the second view.In the second view i try to convert the string value into bytes by using the following codes.
    String sourcestr=wdContext.currentContextElement().getDownloadfile();
             byte bs[]=new byte[1024];
             bs=sourcestr.getBytes();
             wdContext.currentDownloadElement().setDownloadfile(bs);
             But it doesn't work and no error.
             Now i am expecting the valuable suggestions from you.
    Thanks in Advance,
    Kind Regards,
    S.V.Selva Bala.

  • Lightroom 5, book export to pdf, jpg and download with error

    The download of the book to blurb is not possible. I checked also the export to pdf and jpg. This ist also not possible.
    The processe of download or export is aborted with different errors: an error occured or reendering is not possible.
    The hint to check the settings of the background had no effect.
    Hopefully there is any idee how to continue.
    Andreas

    Hi roel2000,
    According to your description, you get error when exporting the report into PDF. It works properly when exporting in excel or PDF format within E-mail subscription. Right?
    In Reporting Services, the Excel and MHTML(e-mail subscription) render extensions are soft page break renderers. The PDF render extension is hard page break renderer. It has different render behavior between these two kind of renders. This might cause the
    error. Since we are not clear about your report structure, please refer to rules in the link below and do the troubleshooting.
    Rendering Behaviors (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Slow Transfer and Downloads with new SSD and Fresh OS

    I have a brand new Solid State Drive and maxed out the RAM in my Mid 2010 15 inch MacBook Pro. The new hard drive made all the difference in the world. But having never done a clean install since the start, I was having issues with some of my older applications. I decided to clear the hard drive and reinstall the OS and discs for Final Cut Studio and my Adobe products. Everything runs smoothly, but only now, when I try to copy from a external drive, whether FireWire or USB it takes exponentially longer to transfer. Same goes for downloading content from a FTP server. Basically anything that is generating new files/data onto my hard drive. This wasn't the case until I re-installed the OS (Had Mavericks before and after the install).
    Any idea what this issue might be?
    My hard drive is a Samsung Electronics 840 Pro Series 2.5-Inch 512 SATA Solid State Drive MZ-7PD512BW
    And as I stated, it worked perfectly before.

    Jay,
    my thoughts were that with Trim command support disabled,  when you’d reïnstalled OS X and your apps and personal files, that your SSD might have gone over 75% full, at which point SSDs’ performance start to slow down. (Without Trim command support, the SSD needs to be “told” manually to reuse space which has been freed up by deletion.) If that is the cause of your current slowdown, then you wouldn’t start noticing a difference until your SSD has run out of previously unused space; at that point, a Trim command would be run on the SSD to make available that previously used space. In the interim, I guess that you could try selecting your SSD in Disk Utility, then select the Erase tab, then press the Erase Free Space… button to see if that would work as a manual substitute for a Trim command. Alternatively, you could try creating dummy files to purposely fill up your SSD nearly to capacity, and then delete them to see if the Trim command will make available all of the space for all of the previously deleted files (i.e. not just for the deleted dummy files).

  • I'm having trouble with a multi channel acquisition and download with PXI-5922

    I am having trouble with getting data out from both channels of a PXI-5922.  My software seems to be working, but when I do the fetch there is no data for the second channel.  I am using the same format for all of the channelList inputs (0,1).  I've checked the instrument handles and anything else I can think of, but this is my first time trying to collect data on 2 channels of a digitizer.  Any help would be appreciated.

    Hi schliepe,
    Try checking your code against an existing example. The
    Developer Zone Example: Independent
    Channel Configuration with NI-SCOPE is a good VI to reference. Also note
    that there are several examples that come with the NI-SCOPE driver. They can be
    found in Windows by going to Start »
    Programs » National Instruments » NI SCOPE » Examples. Additionally, if you find that the examples are not working either, verify that both channels are functioning by running the
    NI-SCOPE Soft Front Panel.
    Please post back if you have any questions. Have a great
    day!
    Ryan D.
    District Sales Manager for Boston & Northern New England
    National Instruments

  • Wpg_docload.download_file hangs

    Hi all!
    I have question about file download using wpg_docload.download_file.
    That looks like that my plsql code hangs on this. It depends on size of blob data what i'm trying download. Also it happens only on one of three servers we have. (All of them are Oracle 10g).
    If anyone have had similar problem pls... answer!
    Best regards!
    Jaan

    Hello Peter,
    I'm not sure whether this is a listener related problem, but we should try to find out.
    I have examples where a temporary blob is created first before the content is passed to WPG_DOCLOAD, which produce a working download on the APEX Listener.
    So I don't think the problem concerns WPG_DOCLOAD but the way you handle your blob, or to be precise, your BFILE.
    What comes to my mind first: Don't you need to open that file? When I use DMBS_LOB.LOADBLOBFROMFILE, I guess this is done somewhere inside that routine, but for other kinds of bfile access, there is DBMS_LOB.FILEOPEN.
    When thinking of that part: If I'm not completely wrong, there is a difference in which db user is acutally executing, or in other words, on whose behalf your code is executed, when you create a temporary blob first and forward it to wpg_docload or have wpg_docload do the file access. The Null Pointer Exception may result from either the file not being existent or not accessible for the db user executing the code. In case of wpg_docload accessing the file, perhaps the user you configured your APEX Listener to connect with needs additional grants for that file access.
    Just a thought. It should be easy to test the same scenario with using a temporary file on APEX Listener to see if that works and start debugging from there.
    -Udo

  • Wpg_docload.download_file slow (or has a memory leak)

    Hi, (Maybe this should be in the pl/sql forum, but since this is so much used in Apex and I ran into this problem there, I decided to post it here).
    There seems to be a memory leak or some other issue with using wpg_docload.download_file
    I have a couple of pages that show many images (50+, icon sized) . And usually a few days after restarting the Oracle http server, I see the image rendering becoming extremely slow (and usually most images timing out.)
    So in all my procedures using :
    wpg_docload.download_file ( lob_loc );
    I switched it out for :
    declare
    buffer raw ( 32000 );
    buffer_size integer := 32000;
    offset integer := 1;
    begin
    while offset < v_length loop
    dbms_lob.read ( lob_loc, buffer_size, offset, buffer );
    htp.prn ( utl_raw.cast_to_varchar2 ( buffer ) );
    offset := offset + buffer_size;
    end loop;
    end;
    And the speed increase in image loading was phenomenal, I am looking at over 10x speed recieving the image data from the webserver.
    Is there a known bug with wpg_docload.download_file in 10.2.0.2?
    But anyways, if anybody else is running into this slowness, then by all means, try out this workaround.
    Regards
    Oli
    edit:
    There seems to be one other thing that matters in the resulting speed of the image retrieval. I used mod_rewrite to make the images look like /icon/1235.jpg
    and after further testing, this seems to be the catalyst for image retrieval. Not the wpg_docload.download_file
    Message was edited by:
    Oli

    Oli,
    Image retrieval for something.jpg is faster then proc?id=1234That fits in with my theory, browsers often will not rely on a cached version for a URL that contains a parameter (after all, how would the browser know whether the URL is going to return the same data or not even if the parameter is the same?). When you request a particular file (i.e. something.jpg then the browser can use the cache since you have requested a particular file, as opposed to calling a 'procedure/function'.
    This is definetly a browser issue, and it has nothing to do with cacheYou browser has a cache and can use it if it wishes to, so I would still suspect it is related to caching (or lack of caching).
    I would suggest producing the smallest possible test case you can so that the behaviour you describe can be demonstrated.

  • Real Player downloads videos from page I'm not even viewing, and "download this video" appears when navigating pages that a video isn't even on page.

    when I try to downlad a video, even when I right click and "download with Real Player" real player refuses to download THAT video if I have any other pages open...
    really frustrating to be forced to close pages to download a video on a page, when that is the one page I no longer want to view, I have already viewed it, and want to download and navigate away.

    Install realplayer again worked for me,hope this helps.

  • After upgrading to Foxfire 8, I cannot connect to Foxfire...have tried to uninstall and reinstall with no luck

    When I click on Firefox I see restore session but no options to do so....cannot get firefox to load....it just sits and tries to run but will not load....I have uninstalled Firefox several times and downloaded with NO luck...help!

    A possible cause is security software (firewall) that blocks or restricts Firefox or the plugin-container process without informing you, possibly after detecting changes (update) to the Firefox program.
    Remove all rules for Firefox from the permissions list in the firewall and let your firewall ask again for permission to get full unrestricted access to internet for Firefox and the plugin-container process and the updater process.
    See:
    *https://support.mozilla.com/kb/Server+not+found
    *https://support.mozilla.com/kb/Firewalls

  • Wpg_docload.download_file to download a zipped file...not working

    I am working with APEX 4.1
    Within the application being developed, it is a requirement to be able to select multiple rows within an interactive report, then click a button to download these as a ZIP file.
    Currently, a field is populated that contains a colon-delimited list of ID values to determine which rows to download, like ":17:127:"
    Upon submitting the page files are chosen and zipped through a process, then downloaded through the same process.
    Here is the PL/SQL process for zip and download:
    declare
      g_zipped_blob blob;
      b_dl_file BLOB;
      v_filename VarChar(1000);
    begin
    for rec in ( select FILE_ID, FILENAME, FILE_BLOB
    from DD_FILES
    where instr(:P9_FILE_ID, ':' || FILE_ID || ':') > 0)
    LOOP
      zip_blobs.add1file( g_zipped_blob, rec.FILENAME, rec.FILE_BLOB );
    end loop;
      zip_blobs.finish_zip( g_zipped_blob );
      select sysdate into v_filename from dual;
      owa_util.mime_header( 'application/octet', false );
      htp.p('Content-length: ' || dbms_lob.getlength(g_zipped_blob));
      htp.p('Content-Disposition:  attachment; filename="'|| v_filename ||'.zip"');          
      owa_util.http_header_close;
      wpg_docload.download_file(g_zipped_blob);
    --dbms_lob.freetemporary( g_zipped_blob);
    end;add1file and finish_zip are stored procedures.
    Currently upon pressing the button, nothing happens(but the page is submitted, nothing seems to happen), although when testing the process, it returns what appears to be a text version of the BLOB (within the SQL commands section of the SQL workshop).
    Any reasons why this would be happening?
    Already posted this in the PL/SQL section but it seems to have been ignored.

    Hi,
    Rather than submitting the page I would try opening a new page (for example, by calling popUpNamed) passing the ids as a parameter to this page. Then have your download process as a before header process on this page.
    Use apex_application.g_unrecoverable_error := TRUE; at the end of your code to ensure that none of the page processing for this page is actually run.
    Rod West

  • BLOB download via WPG_DOCLOAD not working: what's with the document table?

    Hi,
    We upgrade our APEX application to 4.2 on RDBMS 11.2.0.1.0, and now our file downloads are failing with 404-not found errors.
    Documents are stored as BLOBs in a dedicated table TICKETDOC. Uploading works fine via APEX, I can query the docs in the table and all is looking fine so far.
    I have a report column formatted as HTML, making it a clickable thumbnail which should open the file in a separate browser window when clicked.
    HTML format for column:
    +*
    <img src="#OWNER#.DOWNLOAD_FILE?p_id=#THUMBNAIL#" height=40">
    </a>
    *+
    This is supposed to call our own procedure TICKET.DOWNLOAD_FILE, which calls WPG_DOCLOAD:
    +*
    create or replace
    PROCEDURE "DOWNLOAD_FILE" (p_id in number) AS
    l_mime varchar2(255);
    l_length number;
    l_file_name varchar2(2000);
    lob_loc BLOB;
    v_found BOOLEAN := FALSE;
    CURSOR c_doc IS
    SELECT doctype, doc, naam, DBMS_LOB.GETLENGTH(doc)
    FROM ticketdoc
    WHERE ticketdocid = p_id;
    CURSOR c_mail IS
    SELECT mimetype, content_attachment, filenaam, DBMS_LOB.GETLENGTH(content_attachment)
    FROM mailattachment
    WHERE mailattachmentid = p_id;
    param_val owa.vc_arr;
    p_table Varchar2(200);
    l_errm varchar2(2000);
    BEGIN
    p_table := 'TICKETDOC';
    IF p_table = 'TICKETDOC' THEN
    OPEN c_doc;
    FETCH c_doc INTO l_mime, lob_loc, l_file_name, l_length;
    IF c_doc%FOUND THEN
    v_found := TRUE;
    else
    END IF;
    CLOSE c_doc;
    ELSIF p_table = 'MAILATTACHEMENT' THEN
    OPEN c_mail;
    FETCH c_mail INTO l_mime, lob_loc, l_file_name, l_length;
    IF c_mail%FOUND THEN
    v_found := TRUE;
    END IF;
    CLOSE c_mail;
    END IF;
    IF v_found THEN
    --initialise owa with some environment variable
    param_val (1) := 1;
    owa.init_cgi_env(param_val) ;
    -- Set up HTTP header
    -- Use an NVL around the mime type and if it is a null, set it to
    -- application/octect - which may launch a download window from windows
    owa_util.mime_header(nvl(l_mime,'application/octet-stream'), FALSE );
    -- Set the size so the browser knows how much to download
    htp.p('Content-length: ' || l_length);
    -- The filename will be used by the browser if the users does a "Save as"
    htp.p('Content-Disposition: attachment; filename="' || l_file_name || '"');
    -- Close the headers
    owa_util.http_header_close;
    -- Download the BLOB
    wpg_docload.download_file( Lob_loc );
    END IF;
    exception
    when others then
    l_errm := sqlerrm;
    raise;
    END;
    *+
    The idea is to display a thumbnail image which, when clicked, will open the document (image, pdf, whatever) in a new browser window.
    Executing the procedure in SQLDeveloper works fine and I can query the downloaded BLOB (getlength etc).
    However, when I click the thumbnail in the APEX application I get a 404.
    Enabling debug via exec dbms_epg.set_dad_attribute('APEX', 'error-style', 'DebugStyle') yields the following:
    +*
    Fri, 31 May 2013 09:41:35 GMT
    Error retrieving document.
    Please verify that the document you requested exists in the document table
    DAD name: apex
    PROCEDURE : TICKET.DOWNLOAD_FILE
    URL : http://XDB HTTP Server:8080/apex/TICKET.DOWNLOAD_FILE?p_id=1091
    PARAMETERS :
    ===========
    p_id:
    1091
    ENVIRONMENT:
    ============
    PLSQL_GATEWAY=WebDb
    GATEWAY_IVERSION=2
    SERVER_SOFTWARE=Oracle Embedded PL/SQL Gateway/11.2.0.1.0
    GATEWAY_INTERFACE=CGI/1.1
    SERVER_PORT=8080
    SERVER_NAME=XDB HTTP Server
    REQUEST_METHOD=GET
    QUERY_STRING=p_id=1091
    PATH_INFO=/TICKET.DOWNLOAD_FILE
    SCRIPT_NAME=/apex
    REMOTE_HOST=
    REMOTE_ADDR=127.0.0.1
    SERVER_PROTOCOL=HTTP/1.1
    REQUEST_PROTOCOL=HTTP
    REMOTE_USER=ANONYMOUS
    ORACLE_SSO_USER=
    OSSO_IDLE_TIMEOUT_EXCEEDED=
    OSSO_USER_GUID=
    HTTP_CONTENT_LENGTH=0
    HTTP_CONTENT_TYPE=
    HTTP_USER_AGENT=Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
    HTTP_HOST=localhost:8080
    HTTP_ACCEPT=text/html,application/xhtml+xml,*/*
    HTTP_ACCEPT_ENCODING=gzip,deflate
    HTTP_ACCEPT_LANGUAGE=nl-BE,en-US;q=0.5
    HTTP_ACCEPT_CHARSET=
    HTTP_COOKIE=__utmc=31852350; __utmz=31852350.1366364489.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); __utma=31852350.974780296.1366364489.1366364489.1369990367.2; ORA_WWV_USER_61804796552973=930EBD5017F98F039F659148EAE74140; ORA_WWV_REMEMBER_UN=JO:ticket; ORA_WWV_F4000_P4150_TREE=RenderingTree%3A3727930518286945_columns%3A3729417793306453; SHARED_SESSION=87D7D96BC5A457924CB86A817315D30E; [email protected]
    HTTP_IF_MODIFIED_SINCE=
    HTTP_REFERER=http://10.0.25.1/apex/f?p=101:40:7036965658754:::::
    HTTP_SOAPACTION=
    HTTP_ORACLE_ECID=
    HTTP_ORACLE_CACHE_VERSION=
    HTTP_AUTHORIZATION=
    WEB_AUTHENT_PREFIX=
    DAD_NAME=apex
    DOC_ACCESS_PATH=docs
    DOCUMENT_TABLE=wwv_flow_file_objects$
    PATH_ALIAS=
    REQUEST_CHARSET=AL32UTF8
    REQUEST_IANA_CHARSET=UTF-8
    SCRIPT_PREFIX=
    HTTP_IF_MATCH=
    HTTP_CACHE_CONTROL=
    SOAP_BODY=
    HTTP_X_ORACLE_DEVICE_CLASS=
    HTTP_X_ORACLE_DEVICE_ORIENTATION=
    HTTP_X_ORACLE_DEVICE_MAXDOCSIZE=
    HTTP_X_ORACLE_DEVICE=
    HTTP_X_ORACLE_ORIG_ACCEPT=
    HTTP_X_ORACLE_ORIG_USER_AGENT=
    HTTP_X_ORACLE_USER_LOCALE=
    HTTP_X_ORACLE_USER_NAME=
    HTTP_X_ORACLE_USER_DISPLAYNAME=
    HTTP_X_ORACLE_USER_USERKIND=
    HTTP_X_ORACLE_USER_AUTHKIND=
    HTTP_X_ORACLE_USER_DEVICEID=
    HTTP_X_ORACLE_USER_LOCATION_ADDRESSLINE1=
    HTTP_X_ORACLE_USER_LOCATION_ADDRESSLINE2=
    HTTP_X_ORACLE_USER_LOCATION_ADDRESSLASTLINE=
    HTTP_X_ORACLE_USER_LOCATION_BLOCK=
    HTTP_X_ORACLE_USER_LOCATION_CITY=
    HTTP_X_ORACLE_USER_LOCATION_COMPANYNAME=
    HTTP_X_ORACLE_USER_LOCATION_COUNTY=
    HTTP_X_ORACLE_USER_LOCATION_STATE=
    HTTP_X_ORACLE_USER_LOCATION_POSTALCODE=
    HTTP_X_ORACLE_USER_LOCATION_POSTALCODEEXT=
    HTTP_X_ORACLE_USER_LOCATION_COUNTRY=
    HTTP_X_ORACLE_USER_LOCATION_TYPE=
    HTTP_X_ORACLE_USER_LOCATION_X=
    HTTP_X_ORACLE_USER_LOCATION_Y=
    HTTP_X_ORACLE_SERVICE_HOME_URL=
    HTTP_X_ORACLE_SERVICE_PARENT_URL=
    HTTP_X_ORACLE_HOME_URL=
    HTTP_X_ORACLE_MODULE_CALLBACK_URL=
    HTTP_X_ORACLE_MODULE_CALLBACK_LABEL=
    HTTP_X_ORACLE_CACHE_USER=
    HTTP_X_ORACLE_CACHE_SUBID=
    HTTP_X_ORACLE_CACHE_AUTH=
    HTTP_X_ORACLE_CACHE_DEVICE=
    HTTP_X_ORACLE_CACHE_LANG=
    HTTP_X_ORACLE_CACHE_ENCRYPT=
    HTTP_X_ORACLE_ASSERT_USER=
    *+
    I made minor adjustments to the original (pre-4.2) code:
    * initialised owa with some environment variable
    * registered DOWNLOAD_FILE in wwv_flow_epg_include_mod_local
    but still no success.
    Any ideas on how to fix this?
    Greetz
    Jo

    As I understand:
    The procedure works.
    The link 'appears' to work. (ie you saw the procedure run a 2nd at the database level)
    But it doesn't actually work (because you get a 404)
    I think I ran into an issue, on a completely different page type, that produced an 'error 404'. (I can't seem to reproduce it, though)
    The only way I discovered what was really going on was with an HTTP sniffer. (eg HTTPFox for FireFox)
    Through that, I noticed that the browser was (for some reason) calling a completely non-sensible APEX page. (hence the PAGE NOT FOUND error)
    My solution was to add a "submit to self" branch point.
    If that doesn't work, I'm at a loss.
    MK

  • How can I use wpg_docload.download_file and prompt the user to save it?

    Hi,
    Posted about this a couple of weeks ago with a text file and got the following code (where x.zip=x.txt) and it worked fine. Problem is that I need to do this with zip files, and when I run the code below, it simply displays the zip file, rather than prompting the user to save the file. Have tried every mime type under the sun. No joy.
    The How to Upload and Download Files in an Application Advanced Tutorial for Release 3.2 does not work for APEX4. Simply creating a file browse item leads to Error ORA-20999: P3_FILE_NAME has to have a valid BLOB column as source. and so I cannot follow that tutorial to get further clues on how to make this work.
    Susan
    Thanks and here's the wpg_docload.download_file code that displays a binary file:
    declare
    lob_loc bfile;
    v_length integer;
    fname varchar2(100) := 'x.zip';
    l_blob blob;
    des_offset number := 1;
    src_offset number := 1;
    begin
    lob_loc := bfilename('CELFILES_9906', fname);
    v_length := dbms_lob.getlength(lob_loc);
    DBMS_LOB.createtemporary(l_blob, FALSE);
    dbms_lob.open(lob_loc, dbms_lob.lob_readonly);
    DBMS_LOB.LOADBLOBFROMFILE(
    dest_lob=>l_blob,
    src_bfile=>lob_loc,
    amount=>v_length,
    dest_offset=>des_offset,
    src_offset=>src_offset);
    owa_util.mime_header('application/zip', false);
    htp.p('Content-length: ' || v_length);
    htp.p('Content-Disposition: inline; filename="' || fname || '"');
    -- close the headers
    owa_util.http_header_close;
    -- download the BLOB
    wpg_docload.download_file( l_blob );
    DBMS_LOB.freetemporary(l_blob);
    EXCEPTION WHEN OTHERS THEN
    DBMS_LOB.freetemporary(l_blob);
    RAISE;
    end;

    I downlod blobs like this without issue (using IE7 and FF):
    owa_util.mime_header('application/octet', False);
    HTP.p ('Content-length: ' || DBMS_LOB.getlength (l_blob));
    htp.p('Content-Disposition: attachment; filename="'||v('P20_FNAME')||'"');
    OWA_UTIL.http_header_close;
    WPG_DOCLOAD.download_file (l_blob);
    ...Remember, that it's your browser's MIME type settings that determine whether to pop up a save diaglog box. In FF 3.6 > Tools > Options > Applications > Content type. The set action for each mime type.

Maybe you are looking for