Blob download

i have a blob field that contain a text. i try to download this with my procedure:
CREATE OR REPLACE procedure download_content(p_id in number,nome in varchar2) as v_blob BLOB;
v_len NUMBER;
v_buf VARCHAR2(32000);
v_amt NUMBER := 4000;
v_pos NUMBER := 1;
BEGIN select content_ora,length(ora_script_file) into v_blob, v_len
from ver06_scripts
where script_id = p_id;
owa_util.mime_header('application/octet', FALSE );
htp.p('Content-length: ' || v_len);
htp.p('Content-Disposition: attachment; filename="' || nome || '"');
owa_util.http_header_close;
wpg_docload.download_file( v_blob );
EXCEPTION WHEN NO_DATA_FOUND THEN NULL;
end download_content;
this procedure work, but the file is cut....the procedure don't return all the text. what can be the problem???

Hi Massimorigo
Have a look at the File Upload/Download "How To". Compare its code carefully to yours. The "How To" code works, however, you must not make any typos.
Also, are you sure that the file in your BLOB is complete? i.e. is the problem in your upload code?
Cheers,
Patrick Cimolini

Similar Messages

  • Display image for BLOB  Download link in Interactive Report

    I have a table containing BLOB data and am displaying the table in an interactive report. I would like to replace the "Download" text link with an icon that represents the MIME type of the BLOB, but can't seem to find a way to make the substitution. Does anyone know how to do this? Thanks.
    -Jeff

    Hey Ben,
    Thanks for the suggestion. I understand what you are saying, the problem is that when you have an interactive report that includes a BLOB and you use the built-in method for displaying a download link, it only gives you the option of using a text link. The method is outlined in the online help under:
    Home > Advanced Programming Techniques> About BLOB Support in Forms and Reports > About BLOB Support in Reports
    This is done by using the following syntax in the Number/Date Format of the column attribute of the BLOB:
    DOWNLOAD:CC_DOCUMENTS:CONTENTS:ID::MIME_TYPE:FILENAME:UPDATED_ON::attachment:View
    Where the last parameter is the link text. The only problem is that there is no option for substituting an image rather than the link text. That's what I'm trying to work around. Sorry if you new all of this already, but I wanted to explain what I've already done. Thanks for any help you can offer.

  • BLOB download from report region in translated application does not work

    We created an application (APEX 3.1.2) with a base language dutch (300) and a translated application en-uk (3001). The problem is that in the translated application downloading BLOB's from a report region does not work and results in an error (page cannot be found).
    The query source for the region is:
    select naam
    , dbms_lob.getlength(bestand)
    , mimetype
    from bos_documentatie
    The column 'dbms_lob.getlength(filename)' is defined as a 'BLOB Download Format Mask' with the following setting:
    DOWNLOAD:BOS_DOCUMENTATIE:BESTAND:NAAM::MIMETYPE:FILENAME:::attachment:Open
    The URL's to the BLOB documents are different between the dutch and en-uk application:
    dutch:
    http://nldvnr01ux002:7792/pls/xvapexd/apex_util.get_blob?s=4260101889649158&a=300&c=12455124581749125&p=1001&k1=Application Multi Language.doc&k2=&ck=A24A5EA6903C5A9603B86D30F128F4DE&rt=CR
    en-uk:
    http://nldvnr01ux002:7792/pls/xvapexd/apex_util.get_blob?s=4260101889649158&a=300&c=12455124581749125.3001&p=1001&k1=Application Multi Language.doc&k2=&ck=7FF0C64FDD48A4D7A6892CFB2B6BCA57&rt=CR
    As you can see the c parameter for the en-uk version has a '.3001' at the end, the internal ID of the translated application. I don't know if this can be the cause of the problem?

    Hi Peter,
    Thanks for the suggestion. However we have a lot of APEX applications build in that same APEX version (one development database) and upgrading now to a higher APEX version would mean we would have to re-test all our applications and upgrade all our test and production environments, just for this bug. And, maybe the higher APEX version may not solve our problem.
    Thanks and regards,
    Patrick

  • Cannot find BLOB Download Format Mask link.

    Hello,
    I cannot find the "BLOB Download Format Mask" link and I am using a current version of APEX. can someone tell me where I might find it? I have followed the instructions and see no such link under Page Item, Source. Please help!
    Thanks
    LEH

    Scott,
    Yes, I have created a form on a table and that table contains a column of datatype BLOB. I followed the APEX advanced tutorial for uploading and downloading files. Now I want to be able to display the (Blob) images that I have uploaded.
    As I research the topic, I get the feeling that displaying the BLOB image can only be done in APEX 3.1 and up. Is this true? I have that version of APEX installed on my laptop and have successfully completed the "Defining and Viewing BLOB Data in Oracle Application Express 3.1" tutorial found here: http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm
    But I could not do it on the company server that runs APEX 3.0
    Even if I did get the approval to have the company APEX application upgraded to 3.1, there still is the issue of scaling the images so that they are not so large. I understand that there is a UTIL.APEX function "GET_BLOB_FILE_SRC" that would do this for me. I read the documentation at:
    http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10499/api.htm#CHDICGDA
    After reading it, I was still not clear as to how to use it correctly. Is there any documentation on how to implement this function in APEX?
    I did find something that I was hoping would help me. The article is entitled "Show Blob of other table in APEX Form" by Dimitri Gielis can be found here: http://dgielis.blogspot.com/2008/07/show-blob-of-other-table-in-apex-form.html
    I tried to import the file "blob_support.sql" application (on both APEX 3.0 and APEX 3.1 systems) but got errors. I'm not having very much luck here and would appreciate the help in pointing me in the correct direction.
    Help!!
    Thanks
    LEH

  • 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

  • Blob download via wpg_docload is not working

    Hi,
    I've installed a new oracle database server and installed Apex 4.1 recently then transferred my old data and applications from old server.
    My new configurations are
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - ProductionMy oracle Enterprise Manager shows
    Hosts               1          Application Servers     1
    OC4J Instances          1          HTTP Server Instances          1Previously I had Apex 4.0.1 on Apex Listener via Glassfish Server and all of my applications were working perfectly. But on new installation the page which downloads report, via generating rtf code and downloading it through blob, is not working.
    Declare
          l_mime        varchar2 (255);
          l_length      number;
          l_file_name   varchar2 (2000);
          l_lob_loc     blob;
          l_rtf         clob;
          l_name        varchar2(100);
          -- conversion variables
          l_src_offset  number := 1;
          l_dest_offset number := 1;
          l_lang_ctx    number := 0;
          l_warning     varchar2(32767);
       begin
          -- get name
          select 'testrtf'
          into   l_name
          from   dual;
          -- generate document
             select :P16_RTF  into   l_rtf  from   dual;
          --:P16_RTF contains rtf code.
          -- convert to lob
          dbms_lob.createtemporary(l_lob_loc, false);
          dbms_lob.converttoblob(l_lob_loc, l_rtf, DBMS_LOB.GETLENGTH(l_rtf), l_dest_offset, l_src_offset, 0, l_lang_ctx, l_warning);
          l_length  := dbms_lob.getlength(l_lob_loc);
          -- http header
          owa_util.mime_header('application/rtf', false);
          htp.p('Content-length: ' || l_length);
          htp.p('Content-Disposition: attachment; filename="'||l_name||'.rtf"');
          owa_util.http_header_close;
          -- download blob
          wpg_docload.download_file (l_lob_loc);
       end;I've searched and found no help but it seems that there is some DAD configuration problem. my DAD file is like
    <Location /pls/apex>
    Order deny,allow
    PlsqlDocumentPath docs
    AllowOverride None
    PlsqlDocumentProcedure         wwv_flow_file_mgr.process_download
    PlsqlDatabaseConnectString     db:1521:orcl ServiceNameFormat
    PlsqlNLSLanguage               AMERICAN_AMERICA.AL32UTF8
    PlsqlAuthenticationMode        Basic
    SetHandler                     pls_handler
    PlsqlDocumentTablename         wwv_flow_file_objects$
    PlsqlDatabaseUsername          APEX_PUBLIC_USER
    PlsqlDefaultPage               apex
    PlsqlDatabasePassword          ******
    PlsqlRequestValidationFunction wwv_flow_epg_include_modules.authorize
    Allow from all
    </Location>and I wasn't able to find wwv_flow_file_objects$ either. Any suggestions.
    Regards
    Sabir
    Edited by: sabir786 on Dec 29, 2011 11:37 AM

    Thanks Joel,
    not working means the rtf document produced by code does not download
    and I just performed export and import of application from old server to new server.
    and it still works on the old server.
    and code is not altered
    and debug does not show anything special. it shows that all parts are working
    and it seems that process is executing and after execution there no download dialog box or file saving process.
    Elapsed    Execution   Message   Level
    Graph
    0.00000     0.00000     A C C E P T: Request="DOWNLOAD"     4     
    0.00000     0.00000     Metadata: Fetch application definition and shortcuts     4     
    0.00000     0.00000     NLS: wwv_flow.g_flow_language_derived_from=FLOW_PRIMARY_LANGUAGE: wwv_flow.g_browser_language=en-us     4     
    0.00000     0.00000     alter session set nls_language="AMERICAN"     4     
    0.00000     0.00000     alter session set nls_territory="AMERICA"     4     
    0.00000     0.00000     NLS: CSV charset=WE8MSWIN1252     4     
    0.00000     0.00000     ...NLS: Set Decimal separator="."     4     
    0.00000     0.00000     ...NLS: Set NLS Group separator=","     4     
    0.00000     0.00000     ...NLS: Set g_nls_date_format="DD-MM-RR"     4     
    0.00000     0.00000     ...NLS: Set g_nls_timestamp_format="DD-MM-RR HH.MI.SSXFF AM"     4     
    0.00000     0.00000     ...NLS: Set g_nls_timestamp_tz_format="DD-MM-RR HH.MI.SSXFF AM TZR"     4     
    0.00000     0.00000     ...Setting session time_zone to +05:00     4     
    0.00000     0.00000     Setting NLS_DATE_FORMAT to application date format: DD-MM-YYYY     4     
    0.00000     0.00000     ...NLS: Set g_nls_date_format="DD-MM-YYYY"     4     
    0.00000     0.00000     ...NLS: Set g_nls_timestamp_format="DD-MM-RR HH.MI.SSXFF AM"     4     
    0.00000     0.00000     ...NLS: Set g_nls_timestamp_tz_format="DD-MM-RR HH.MI.SSXFF AM TZR"     4     
    0.00000     0.00000     ...metadata, fetch translated app info     4     
    0.00000     0.03200     ...fetch session state from database     4     
    0.03200     0.00000     fetch items     4     
    0.03200     0.00000     ...fetched 0 session state items     4     
    0.03200     0.00000     Authentication check: MY_AUTH (NATIVE_CUSTOM)     4     
    0.03200     0.00000     ... sentry+verification success     4     
    0.03200     0.00000     ...Session ID 3463045368955985 can be used     4     
    0.03200     0.00000     ...Check session 3463045368955985 owner     4     
    0.03200     0.00000     Setting NLS_DATE_FORMAT to application date format: DD-MM-YYYY     4     
    0.03200     0.01500     ...NLS: Set g_nls_date_format="DD-MM-YYYY"     4     
    0.04700     0.00000     ...NLS: Set g_nls_timestamp_format="DD-MM-RR HH.MI.SSXFF AM"     4     
    0.04700     0.01600     ...NLS: Set g_nls_timestamp_tz_format="DD-MM-RR HH.MI.SSXFF AM TZR"     4     
    0.06300     0.01600     ...Check for session expiration:     4     
    0.07900     0.00000     ...Metadata: Fetch Page, Computation, Process, and Branch     4     
    0.07900     0.00000     Session: Fetch session header information     4     
    0.07900     0.00000     ...metadata, fetch page info     4     
    0.07900     0.00000     ...Validate item page affinity.     4     
    0.07900     0.00000     ...Validate hidden_protected items.     4     
    0.07900     0.00000     ...Check authorization security schemes     4     
    0.07900     0.00000     Authorization Check: "Check Permissions" Caching: "BY_USER_BY_PAGE_VIEW" Component: "APPLICATION"     4     
    0.07900     0.00000     ...Execute Statement: select count(*) from dual where exists (select 1 from --omitted--)     4     
    0.07900     0.01500     ... passed     4     
    0.09400     0.00000     Session State: Save form items and p_arg_values     4     
    0.09400     0.00000     ...Session State: Save Item "P16_RTF" newValue="{\rtf1\ansi\deff0 {\fonttbl {\f0 Courier;}} {\colortbl;\red0\green0\blue0;\red255\green0\blue0;} \landscape \paperw15840\paperh12240\margl720\margr720\margt720\margb720 \tx720\tx1440\tx2880\tx5760 This line is the default color\line \tab this line has 1 tab\line \tab\tab this line has 2 tabs\line \tab\tab\tab this line has 3 tabs\line \tab\tab\tab\tab this line has 4 tabs\line \cf2 \tab This line is red and has a tab before it\line \cf1 \page \par\pard\tx1440\tx2880 This line is the default color and the first line on page 2\line \tab\tab This is the second tab on the second line on the second page\line \page \par\pard This is the third page with formatting examples\line \fs30 First line with 15 point text\line \fs20 Second line with 10 point test\line \i Italics on \i0 Italics off\line \b Bold on \b0 Bold off\line \scaps Small Caps On \scaps0 Small Caps Off\line \strike Stike through on \strike0 Strike Off\line \caps All Capitals On \caps0 All Capitals Off\line \outl Outline on \outl0 Outline Off\line \ul Underline on \ul0 Underline Off\line \uldb Double Underline on \ul0 Double Underline Off\line \ulth Thick Underline on \ul0 Thick Underline Off\line \ulw Underline words only on \ul0 Underline words only off\line \ulwave Wave Underline on \ul0 Wave underline off\line \uld Dotted Underline on \ul0 Dotted underline off\line \uldash Dash Underline on \ul0 Dash underline off\line \uldashd Dot Dash Underline on \ul0 Dot Dash underline off\line } " "escape_on_input="N"     4     
    0.09400     0.00000     ...Session State: Save Item "P16_TESTRTF" newValue="" "escape_on_input="N"     4     
    0.09400     0.01600     Processes - point: ON_SUBMIT_BEFORE_COMPUTATION     4     
    0.11000     0.00000     Branch point: Before Computation     4     
    0.11000     0.00000     Computation point: After Submit     4     
    0.11000     0.00000     Tabs: Perform Branching for Tab Requests     4     
    0.11000     0.00000     Branch point: Before Validation     4     
    0.11000     0.00000     Validations:     4     
    0.11000     0.00000     Perform basic and predefined validations:     4     
    0.11000     0.00000     Perform custom validations:     4     
    0.11000     0.00000     Branch point: Before Processing     4     
    0.11000     0.00000     Processes - point: AFTER_SUBMIT     4     
    0.11000     0.01500     ...Process "Download" - Type: PLSQL     4     
    0.12500     0.03200     ...Execute Statement: begin Declare l_mime varchar2 (255); l_length number; l_file_name varchar2 (2000); l_lob_loc blob; l_rtf clob; l_name varchar2(100); -- conversion variables l_src_offset number := 1; l_dest_offset number := 1; l_lang_ctx number := 0; l_warning varchar2(32767); begin -- get name select 'testrtf' into l_name from dual; l_rtf := '{\rtf1\ansi\deff0 {\fonttbl {\f0 Courier;}}'; l_rtf := l_rtf || '{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}'; l_rtf := l_rtf || '\landscape'; l_rtf := l_rtf || '\paperw15840\paperh12240\margl720\margr720\margt720\margb720'; l_rtf := l_rtf || '\tx720\tx1440\tx2880\tx5760'; l_rtf := l_rtf || 'This line is the default color\line'; l_rtf := l_rtf || '\tab this line has 1 tab\line'; l_rtf := l_rtf || '\tab\tab this line has 2 tabs\line'; l_rtf := l_rtf || '\tab\tab\tab this line has 3 tabs\line'; l_rtf := l_rtf || '\tab\tab\tab\tab this line has 4 tabs\line \cf2'; l_rtf := l_rtf || '\tab This line is red and has a tab before it\line'; l_rtf := l_rtf || '\cf1 \page'; l_rtf := l_rtf || '\par\pard\tx1440\tx2880'; l_rtf := l_rtf || 'This line is the default color and the first line on page 2\line'; l_rtf := l_rtf || '\tab\tab This is the second tab on the second line on the second page\line'; l_rtf := l_rtf || '\page'; l_rtf := l_rtf || '\par\pard'; l_rtf := l_rtf || 'This is the third page with formatting examples\line'; l_rtf := l_rtf || '\fs30 First line with 15 point text\line'; l_rtf := l_rtf || '\fs20 Second line with 10 point test\line'; l_rtf := l_rtf || '\i Italics on \i0 Italics off\line'; l_rtf := l_rtf || '\b Bold on \b0 Bold off\line'; l_rtf := l_rtf || '\scaps Small Caps On \scaps0 Small Caps Off\line'; l_rtf := l_rtf || '\strike Stike through on \strike0 Strike Off\line'; l_rtf := l_rtf || '\caps All Capitals On \caps0 All Capitals Off\line'; l_rtf := l_rtf || '\outl Outline on \outl0 Outline Off\line'; l_rtf := l_rtf || '\ul Underline on \ul0 Underline Off\line'; l_rtf := l_rtf || '\uldb Double Underline on \ul0 Double Underline Off\line'; l_rtf := l_rtf || '\ulth Thick Underline on \ul0 Thick Underline Off\line'; l_rtf := l_rtf || '\ulw Underline words only on \ul0 Underline words only off\line'; l_rtf := l_rtf || '\ulwave Wave Underline on \ul0 Wave underline off\line'; l_rtf := l_rtf || '\uld Dotted Underline on \ul0 Dotted underline off\line'; l_rtf := l_rtf || '\uldash Dash Underline on \ul0 Dash underline off\line'; l_rtf := l_rtf || '\uldashd Dot Dash Underline on \ul0 Dot Dash underline off\line}'; -- generate document -- select :P16_RTF into l_rtf from dual; -- convert to lob dbms_lob.createtemporary(l_lob_loc, false); dbms_lob.converttoblob(l_lob_loc, l_rtf, DBMS_LOB.GETLENGTH(l_rtf), l_dest_offset, l_src_offset, 0, l_lang_ctx, l_warning); l_length := dbms_lob.getlength(l_lob_loc); -- http header owa_util.mime_header('application/rtf', false); htp.p('Content-length: ' || l_length); htp.p('Content-Disposition: attachment; filename="'||l_name||'.rtf"'); owa_util.http_header_close; -- download blob wpg_docload.download_file (l_lob_loc); exception when others then htp.p('Error printing'); end; end;     4     
    0.15700     0.00000     ...Process "Ages" - Type: PLSQL     4     
    0.15700     0.00000     ......Skip because condition or authorization evaluates to FALSE     4     
    0.15700     0.00000     ...Process "Ages_table" - Type: PLSQL     4     
    0.15700     0.00000     ......Skip because "When Button Pressed" doesn't match with REQUEST     4     
    0.15700     0.00000     Branch point: After Processing     4     
    0.15700     0.00000     ...No branch specified, redirect to current page     4     
    0.15700     0.00000     Stop APEX Engine detected     4     
    0.15700     0.00000     Stop APEX Engine detected     4     
    0.15700     0.00000     Final commit     4     
    0.15700     -     End Page Processing     4     -

  • Blob download issue

    Hi , all. Why that code:
            select some_csv_blob
            from somewhere
            where someone = somewhat
           v_mime:= 'text/csv';
           v_file_name:= 'some_file_with_a_strange_name';
           OWA_UTIL.mime_header (NVL (v_mime, 'application/octet'), FALSE);
            HTP.p ('Content-length: ' || v_length);
            if INSTR(UPPER(OWA_UTIL.GET_CGI_ENV('HTTP_USER_AGENT')), 'MSIE') > 0 then
               HTP.P ('Content-Disposition:  attachment; filename="'
               || UTL_URL.ESCAPE( v_file_name, FALSE, 'UTF-8' ) || '"');
            else
               HTP.P('Content-Disposition:  attachment; filename*=UTF-8'''''||UTL_URL.ESCAPE( v_file_name, FALSE, 'UTF-8' ));
            end if;
            OWA_UTIL.http_header_close;
            WPG_DOCLOAD.download_file(blob_content);
            apex_application.stop_apex_engine;
    always force browser not to download a blob file , but load into current browser window ?
    Thanks in advance.

    Any thoughts ?

  • Multiple Blob downloads in one report cell

    Hi all,
    I want to create an interactive report. This report is based on 2 tabled that are joined. one table has topics in it the other documents attached to the topics.
    the problem i'm facing is that a topic can have multiple docs attached to it.
    At this moment (Only one doc per topic) I don't have a problem to create the download link to this BLOB using the dbms_lob.getlength.
    Since there could be more documents attached to one topic it is impossible to me to show all the download links in the same row.
    I tried creating my own HTML table with the DBMS_LOB.getlength in separate rows but it doesn't work because it has to be a number and when I do that it is a string.
    Does anybody have an idea on how to solve this? Maybe creating some sort of report in my report but I don't know how to do this.
    Thanks
    Steven

    Steven,
    I haven't done it before and am not 100% sure it will work but how about writing a function that uses the pl/sql method of retrieving blobs where the function reads all the topics and puts them into one string that you return (just using a pl/sql loop). Then you can call that function from your report.
    -- Sharon

  • 4.2 blob download format mask not working

    I am using Apex 4.2
    I have been working through the book Beginning Oracle Application Express 4. In chapter 6 the a blob is added to a report.
    I have pasted the code example into the report definition (albeit with my own page numbers) :
    SELECT
       "TICKET_DETAILS"."TICKET_DETAILS_ID" "TICKET_DETAILS_ID",
       "TICKET_DETAILS"."TICKET_ID" "TICKET_ID",
       "TICKET_DETAILS"."DETAILS" "DETAILS",
       "TICKET_DETAILS"."CREATED_ON" "CREATED_ON",
       "TICKET_DETAILS"."CREATED_BY" "CREATED_BY",
       dbms_lob.getlength("ATTACHMENT") ATTACHMENT
    FROM
       "TICKET_DETAILS"
    WHERE (("TICKET_DETAILS"."TICKET_ID" = :P5_TICKET_ID))
    I go to the report attributes and click on the attachment column.  I enter the suggested format mask
    DOWNLOAD:TICKET_DETAILS:ATTACHMENT:TICKET_DETAILS_ID::MIME_TYPE:FILE_NAME:::inline:Download.
    When I press apply I keep getting :
    1 error has occurred
    "" not found. (Go to error)
    I have confirmed that the query runs and that P5_TICKET_ID does exist on page 5.
    Not understanding what this meant I tracked down this page
    17.10 About BLOB Support in Forms and Reports
    and the section "Providing a Download Link" seems to confirm that the above format mask is correct.
    Any pointers would be greatly appreciated.

    I've also done the exercises in the book and it worked for me.
    Your format mask is correct. But before pressing submit you also have to enter the blob column attributes:
    *Format Mask (Value Required):                   DOWNLOAD
    *Blob Table (Value Required):                       TICKET_DETAILS
    *Blob Column (Value Required):                   ATTACHMENT
    *Primary Key Column 1 (Value Required):     TICKET_DETAILS_ID
    Primary Key Column 2:
    Mimetype Column:                                      MIME_TYPE
    Filename Column:                                       FILE_NAME
    Last Updated Column
    Character Set Column:
    Content Disposition:                                    ATTACHMENT
    Download Text:                                           Download
    Maybe you forgot that?

  • Referencing report columns in the BLOB download link format mask

    Hi there,
    In a basic report (Apex 4) I have a link to download a BLOB stored in the table. However to save space, instead of using 2 columns, one for the file name and one for the download link, I want to use only one column where the file name is the download link itself.
    To do this, I tried using this download link format mask (ATTACH_FILENAME is the report column that contains the file name):
    DOWNLOAD:ATTACHMENTS:ATTACH_BLOB:ATTACHMENT_ID::ATTACH_MIME_TYPE:ATTACH_FILENAME:::attachment:#ATTACH_FILENAME#
    However it shows #ATTACH_FILENAME# in all rows instead of the actual file name!
    I know that using substitution strings (&) works, so is there a way to also reference report columns in this format mask?
    Thanks
    Luis

    Luis, did you finally resolve this? I have the same question.

  • Blob download error - "ResourceNotFound"

    Update:
    The problem here was caused because the container permissions got reset when uploading more files. Maybe a more informative error message such as "Access denied.." would have been more helpful.
    Hi,
    This morning I am unable to download files from our blob storage when using either the storage alias url or the direct blob url. The error message that I get is:
    <Error>
    <Code>ResourceNotFound</Code>
    <Message>
    The specified resource does not exist. RequestId:c0e0dc69-0001-001d-10ed-3bc478000000 Time:2014-09-02T08:50:50.9567158Z
    </Message>
    </Error>
    I can download the files from the Azure portal directly but not via an absolute url.
    Regards,
    Chris Miller

    Hi Miller,
    Based on your description, you couldn't download the file via url because of the container permission, and the error message is "ResourceNotFound", I think this error message is reasonable, your request is failed because of the resource
    is protected, not the access denied.
    Thank you for sharing the solution here, if you have any further issues, welcome to our forum again.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • BLOB download from table

    Hello everybody,
    I am newbie here and not very experienced with JSF. :)
    I have a mySQL database with different kind of data in it. My web application displays the results of a SELECT directly on the browser via a table; some of the fields contain BLOB (pdf) objects that are displayed as an alphanumeric string: my idea would be to have something like a link to download the blob instead!
    Is there a JSF solution to my problem?
    Thanks!

    This is what I did
    In my JSF page
    < h:graphicImage height="262" width="350" url="#{img.imgurl}"/>
    The call a servlet to display the BLOB image code below
    public class ImageBean {
         private String imgurl;     
         public ImageBean(String incidentid, String image_id){
         this.imgurl = "/faces/dispImage?fieldhh_inspectionid="+incidentid+"&pictures="+image_id;
         public void setImgurl( String imgurl){
              this.imgurl = imgurl;
         public String getImgurl(){
              return(imgurl);
    } // end class
    My Servlet Stuff
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import oracle.sql.BLOB;
    public class dispImage extends HttpServlet {
         ServletConfig svconfig = getServletConfig();
         Connection connection_mysql = null;
         protected void doPost(HttpServletRequest request,
                                                      HttpServletResponse response) throws ServletException, IOException {
    doGet(request,response);
    protected void doGet(HttpServletRequest request,
    HttpServletResponse response) throws ServletException, IOException {
    int t_number = 0;
    int image_number = 0;
    ServletOutputStream out = response.getOutputStream();
    t_number = Integer.parseInt(request.getParameter("fieldhh_inspectionid"));
    image_number = Integer.parseInt(request.getParameter("pictures"));
    response.setContentType("image/jpeg");
         byte[] bytes = null;
         Blob blob = null;
         ServletContext context = getServletContext();
         String mysql_driver =context.getInitParameter("jdbcDriver");
         String user = context.getInitParameter("username");
         String password = context.getInitParameter("password");
         String dbURL =context.getInitParameter("dbUrl")+"?user="+user+"&password="+password;
         try{
         Class.forName(mysql_driver);
         Statement stmt = null;
         ResultSet rset = null;
         connection_mysql = DriverManager.getConnection(dbURL);
         connection_mysql.setAutoCommit( false );
         stmt = connection_mysql.createStatement();
              String selString = "select image from images where incidentid = "+t_number+" and image_id ="+image_number;
              byte [] image;     
              rset = stmt.executeQuery(selString);
              while(rset.next()){
              blob = rset.getBlob(1);     
    bytes = blob.getBytes(1,(int)blob.length());
              out.write(bytes);
              out.flush();
              out.close();
         } // end try
         catch(Exception e){
         e.printStackTrace();
         e.getMessage();
    } // end of doGet
    public byte[] getBlob(int tfir_num, int image) {
    byte[] bytes = null;
         ServletContext context = getServletContext();
         Blob blob = null;
         try{
         Statement stmt = null;
         ResultSet rset = null;
         stmt = connection_mysql.createStatement();
         String selString = "select image from images where incidentid = "+tfir_num;
              rset = stmt.executeQuery(selString);
         while(rset.next()){
              blob = rset.getBlob(1);
    rset.close();
    bytes = blob.getBytes(1, (int)(blob.length() ));
              connection_mysql.close();
         } // end try
         catch(Exception e){
         e.printStackTrace();
         e.getMessage();
    //     System.out.println("DONE returning byte");
         return(bytes);
    }// end dispImage class

  • BLOB Download Format Mask

    Hi there
    I've got this in my report:
    DOWNLOAD:MYTABLE:MT_FILE:MT_ID:::MT_FILENAME:::attachment:Download
    I was wondering - is it possible to change 'Download' to the value of MT_FILENAME? I've tried #MT_FILENAME# and MT_FILENAME with no luck.
    It would be nice not to "waste" an extra column for 'Download' if I could just make the filename listed as a download-link instead.. Any inputs?
    Cheers,
    Vidar

    Why dont you just put the link on the blob column. Then when you click on the image it prompts the user to save the blob.
    null

  • How to changeDownload label for BLOB download

    Hello,
    Is there any way to change the label Download to file name instead.
    For example, I have uploaded file abc.txt to BLOB column, now I would like to have abc.txt link so that when user click on it (instead of traditional Download link), download page popup
    Please advice me.
    Thanks

    Did you ever resolve this question yourself? I have the same problem.

  • Broken blob download misery

    Dear heroes,
    Please help me out.
    I implemented file up/download using a custom table as advised in the HowTo, and for a few weeks everything was beautiful. Now alas, downloads have developed a problem.
    My custom download proc is called download_oledoc (code below), and it's invoked by a report column link:
    #OWNER#.download_oledoc?p_oledoc=#OLEDOC#
    where the report's oledoc column holds the primary key of the file to be downloaded. The proc query returns values correctly.
    When the link is clicked to download a file called e.g. my_file.doc, the popup dialog is incorrect.
    In MSIE I get a File Download dialog showing:
    File name: ANIX.txt
    File type: Text document
    In Firefox the dialog reads:
    'You have chosen to open ANIX.download_oledoc which is a DOWNLOAD_OLEDOC file...'
    If I tell the dialog to Save the file, the file contents are downloaded correctly, but to the wrong filename ("ANIX.download_oledoc").
    (I think the problem may have started when I implemented mod_gzip - with which everything else worked fine - but it persists now with mod_gzip switched off.)
    All assistance much appreciated.
    Thanks, John D
    HTMLDB 1.6, db 10g, Apache 1.3
    Proc code:
    create or replace procedure download_oledoc
    ( p_oledoc in number
    as
    v_mime varchar2(255);
    v_length number;
    v_file_name varchar2(2000);
    Lob_loc BLOB;
    begin
    select mime_type,
    olecontent,
    substr(filename,instr(filename,'\',-1) +1),
    dbms_lob.getlength(olecontent)
    into v_mime,
    lob_loc,
    v_file_name,
    v_length
    from oledoc
    where oledoc = p_oledoc;
    -- 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="' || v_file_name || '"');
    -- close the headers          
    owa_util.http_header_close;
    -- download the BLOB
    wpg_docload.download_file( Lob_loc );
    end download_oledoc;

    Greg, Vikas,
    Thanks for your interest.
    My download is used on many pages.
    Even if page delete and rebuild fixes the problem I do NOT want to delete and rebuild all affected pages without some reason to believe that the problem will not recur.
    In any case, the fact the problem is common to many pages points to the problem being somewhere in my procedure or wpg_docload, rather than in caused by a page-specific quirk.
    Anybody at Oracle able to help? Please?
    JD

Maybe you are looking for