Download BLOB from report

Hi,
I would like to add a download link into a report for each row so that the user can download a BLOB. I have created a column in which to add a column link which when clicked will provide a popup which gives the user a choice of whether to save or open the file.
I can get this to work on a static file by adding "p?n=7101305566584499" to the URL field in the column link section or the report column, but cannot get it to work on a dynamically-created file. I have written a procedure to create a file of the BLOB and can get the BLOB to be opened in the browser if I add to the URL field: "#OWNER#.fossilapp_pkg.download_image_jpeg?p_image_id=#Download#" - I know, therefore, that both the file-generating procedure and the reference to it work. However, I don't want the image to be opened in the browser, but instead would like a popup to appear asking the user to save or open the file.
If I put "p?n=#OWNER#.fossilapp_pkg.download_image_jpeg?p_image_id=#Download#" into the URL field I get the following error when I click on the column link: "The requested URL /pls/apex/p was not found on this server."
Any ideas?
Thanks,
Lucy

Hi,
I have found the problem - very simple really! I copied and modified a custom download procedure from somewhere on the forum and I have just noticed that 'Content-Disposition' was incorrectly spelled as 'Content-desposition'. Correcting this error means it now works!
Thanks for your help - yes, what you had on your website was exactly what I required. Sorry for adding random stats into it, though it was nice to 'win' £100,000! I couldn't find an obvious way to delete the stats I had added, but feel free to delete them and my profile (username=Lucy).
Cheers,
Lucy

Similar Messages

  • Downloading BLOB from a table.

    Hello,
    First I want to say thatnks for such a great tool like HTMLDB.
    Question is:
    How do I download BLOB from a table. What I am trying to do is. I am uploading files to a default HTMLDB location (wwv_flow_file_objects$) and moving the records to different table (delete file from wwv_file_objects$). Then I would like to be able to download that blobs from a DB by following some link. And I need it to be secure, user have to authenticate to do it. I got to the point where I created process (before header) to download the file. But I am having hard time passing some variables to that process in URL. Can some one advice me on the best practice of doing it. And also if it is a right thing to use before header process to put my own header and start uploading blob in html db. The main reason I do not whant to use DAD for that is simple security issue and ability of storing of the BLOBs only in one table. I prefer to upload it to a temporary location and then move it to other table(s). Then I need to be able to retriev the files back from those tables without moving them around.
    Any help is greatly appriciated

    i think i see what you're asking, but i'll step through the pieces just to make sure i cover your issue:
    it sounds as if you have a procedure that successfully calls wpg_docload.download_file to get your blob out of your images table. for this explanation, lets just say your images table has the same table structure as wwv_flow_files created with something like...
    create table myfiles as select * from wwv_flow_files where rownum < 3;
    ....and let's say your download proc that passed the blob from your myfiles table to wpg_docload.download_file looked something like...
    create or replace procedure getmyfile(
    p_id in varchar2,
    p_mime_type in varchar2 default null)
    as
    l_lob blob;
    l_mimetype varchar2(48);
    l_mime_charset varchar2(255);
    l_filename varchar2(400);
    begin
    select mime_type, blob_content, filename, file_charset
    into l_mimetype, l_lob, l_filename, l_mime_charset
    from myfiles
    where id = p_id;
    if l_mime_charset is not null then
    owa_util.mime_header( l_mimetype, FALSE, l_mime_charset );
    else
    owa_util.mime_header( l_mimetype, FALSE );
    end if;
    htp.p('Content-length: ' || dbms_lob.getlength( l_lob ));
    htp.p('Content-Disposition: attachment; filename="' ||
    wwv_flow_utilities.escape_url( p_url => l_filename, p_url_charset => 'utf-8') || '"');
    owa_util.http_header_close;
    wpg_docload.download_file( l_lob );
    end;
    ...then it sounds as if this is where you start running into issues. to be able to call this procedure from the url, you'd have to grant execute on your getmyfile proc to the db user that your modplsql DAD uses to access your db. once that user was given access to run getmyfile, you could access your files in myfiles by calling a URL like...
    http://myserver.com/pls/mydad/myschema.getmyfile?p_id=1005529367869246
    ...where p_id is the unique id associated with your blob in getmyfiles (you could, of course, use whatever method you want to uniquely identify that file and adjust your select-into statement w/in your getmyfile procedure). so that's all fine and dandy, but it sounds as if you want users to have to authenticate into your html db application before they can access a blob in your images table. it also sounds as if you're on the right track to do so by putting your procedure call in a before_header html db process. you could quite easily call your getmyfile procedure in such an html db pl/sql before_header process with something like...
    begin
    getmyfile (p_id => 1008411584930314);
    end;
    ...which would cause your page to just show the blob associated with the id you passed to getmyfile. because you're now accessing your blob table through html db parsing as your application schema owner, you'd no longer need to grant execute on getmyfile to your modplsql DAD's db user. that eliminates most of the security hole to which you were referring. now that you're calling getmyfile from w/in an html db process, you can take advantage of all the other html db perks such as applying conditions and an authorization scheme to the html db process to really lock things down. finally, you asked about firing your process before_header versus other firing points. before_header is a good way to go, but if you really wanted to execute other procedural logic on your page before showing the blob (and you didn't want to implement that code as before_header processes that fire sequentially before your getmyfile call),you could just throw an htp.init in right before your getmyfile call to clear out your http buffer like so...
    begin
    htp.init;
    getmyfile (p_id => 1008411584930314);
    end;
    ...hope this helps,
    raj

  • Downloading data from report painter report in background

    Hi Guy,
    I have a requirement where in have to schedule the job and download the data on application server from report which is been written report writter. there is an option to save the export paramater but i can download it only in forground.
    Any one have any idea on this...or the other idea is to run the function and get the values from report written in report writer ...so i can use it in my program and  download.
    Atul

    Hi,
    If you run program in Background job sheduled then goto Spool - > there you can file your report - You can download that report.
    Regards
    Md.MahaboobKhan

  • Download BLOB in Report causes ORA-06502

    I built a page with a report showing a table of files and some more information.
    When i view the page the report shows the ORA-06502 error.
    I use this format to build the download link:
    DOWNLOAD:OVV_HANDBUCH:DATEI:ID::MIMETYPE:DATEINAME:::attachment:Herunterladen
    The Table is called ovv_handbuch
    The PK column: id
    The blob column: datei
    The filename column: dateiname
    The mimetype column: mimetype
    Does perhaps the charset WE8MSWIN1252 of the database could be a problem?

    Hi,
    You can install Demonstrative application to your workspace and check there how that report can be done
    To install demo app:
    Home>Create Application and select Demonstration Application
    Check then page 3 report
    Br,Jari

  • Patching: HTTP errors when downloading blobs from proxy controller to agent

    Hi all,
    I have a persistent issue which I can't figure out. Oracle support aren't much help.
    When applying a Recommended Baseline patchset to our managed Solaris 10 servers, I have observed that blobs are downloaded to the target servers at a rate of 1-2 blobs per minute. I consider this to be quite slow, but that's not my main problem.
    At some point during the blob downloads, http errors start appearing in /var/scn/update-agent/logs/error.log on the target server....
    HTTP request failed. Reason: Moved temporarily.
    HTTP request failed. Reason: Bad gateway.
    Eventually, the blob download job fails completely...
    118099456 Download aborted.
    Our servers are quite a way behind in their patching levels. Consequently, we often need to apply as many as 200 patches to a single server. We are lucky to download 100 patches (blobs) before the http errors begin.
    The errors would seem to indicate that the http servers on the proxy controllers are refusing any further connections midway through the blob downloads. I have tried tweaking the httpd.conf file on the proxy controllers - increased the number of httpd processes running and increased MaxClients to 100. None of this has helped.
    The proxy controllers have interfaces on the same subnet as the target servers. Network performance between proxy and asset is good.
    Has anyone else experienced similar issues with patching ?
    Does anyone have any suggestions for httpd.conf settings on the Proxy Controllers ?
    Cheers,
    Graham

    So I have figured out the issue and as Eddie mentioned it is because the email attribute is not synced.  For some reason when I go into Manage User Profiles I am unable to edit anything, i.e. I cannot add the email address.  
    I am able to create a whole new user, which I did (already existed in AD) and of course included the email attribute.  When I sign into sharepoint with this user I am then able to view IRM protected documents.
    I cannot figure out why the email attribute is not synced to SP.  As mentioned above it seems the UPS does not work in a standalone SP install, but my undesrtanding is that when i sign into SP it is going to AD to autheticate, so why then does it not
    also retrieve the email attribute as well?
    I created an SharePoint Active Directory Import job, it runs successfully, it imports all my users from AD, but again without the eamil attribute!  Very strange.  If anyone has any clues I am all ears.

  • Change download columns from report

    Hi! I have a report, with some columns and I'd like to change the columns when downloading as csv file.
    Let's say that I have a report with col1,col2, col3,col4 and some hidden columns: col5, col6, col7. When I download the file I'd like to have only
    col2, col3, col6, col7.
    How can I do this?
    Thanks!

    Currently there is no way to do this. The CSV export function just re-runs the exact same report as you see it on the screen and transforms it to CSV format.
    Another option is to create a report with the columns you want in the CSV on another page, and use the export:CSV template as in
    http://tinypic.com/jzya2t.jpg
    and provide a link to that page. This will run that page and instead of showing the page it will popup the File download box.
    Hope this helps.

  • Downloading BLOB from DB to local filesystem

    We have a requiremnt to provide a JSP page that allows user to select a file that is stored as a BLOB in an Oracle 9 DB and download to local machine.
    We have the listing of files working, but not 100% sure how to go about the actual file download code. Can anyone point us in the right direction? Sample code?
    Oracle 9i DB
    JDev 9.052
    Java 1.4
    Thanks,
    Mike

    Thanks, Francois.
    Is there another way?
    Basically, what our users want is to open pdf document stored as a blob column.
    My idea was to save document to AS and then open it using web.show_document().
    I would like to avoid saving file to clients PC and reduce network traffic.
    Mario
    Message was edited by:
    MarioK

  • Downloading files from report on page

    on apex.oracle.com I have an app and I have uploaded a few pdf files via the "shared components->files->static files" The pdf name is ssgr.pdf I've got a table within my schema for item information and one of the columns references these files. I have the pdf name "ssgr.pdf" stored for one of my items.
    Can I not use a column link and a url target set like p?n=#WORKSPACE_IMAGES##COLUMN_NAME# to download those files?
    When I hover over my link column this is the url that is displayed
    http://apex.oracle.com/pls/otn/p?n=wwv_flow_file_mgr.get_file?p_security_group_id=3505878102606702610&p_fname=SSGR.pdf
    Thanks,
    Ben Alvey

    sorry, I just answered my own question. I removed the p?n= portion from the link column url, now when I click it I get an inline pdf. sweet!

  • Printing Word Document stored in BLOB from Reports

    I have stored images and MS-Word documents in the DB in a BLOB column. Using reports 6, I am able to print the images by setting the File Format property of the item to Image. What I need to know is how can I print the Word document that has been stored in the DB using reports? Any alternative suggestions welcome...
    Thanks for your help.
    Aparna

    Hi Aparna,
    I have tried the same with CLOB instead BLOB.
    (MS Word)
    Only problem is (as expected) any graphics (BOLD, Table etc) will not work when printing. It also replaces the TABS with A single space.
    If you have found an answer, please let me know.
    Tissa
    ([email protected])
    null

  • Download file from button

    Hi Guys,
    I followed thread 214709 (download blob from table) and had similar code in my Portal app. I have a stored procedure with almost identical code. My page has a drop down list which shows the last 12 sales files a customer can download. Behind it I have a Download Button.
    The procedure gets executed but the download window does not show up. If I put the call in a before header it actually works so nothing is wrong with the code. Where do I have to put the call and do I have create an additional branch. After download theu user should stay on that page. I actually have 3 sections with 3 buttons to download or request a file to be emailed.
    So my last question is what is best practice in this situation.

    the thread you followed...
    Downloading BLOB from a table.
    ...showed you how to make a procedure similar to our P procedure that's used to fetch blobs out of a document table. once your file download procedure works, you can call it from the web in one of three main ways:
    1) using an image tag as shown in File Upload ( again! )
    2) using an anchor tag as shown at the top of File download-upload
    3) directly calling it from the URL. this is effectively the same thing as clicking on a link from an anchor tag in number 2, above.
    it sounds as if your download procedure's working because you said it works if you call it before_header. i'm gathering from your post that you are currently trying to call your download procedure in some kind of after submit process. you're finding that your procedure's executing, but you don't see your file. i just set up a test case for this and found that if my page didn't have a branch on it, my after_submit process did render my image correctly. it doesn't sound as if this is what you're shooting for, though. it sounds as if you just want a select list that allows users to select a particular doc. after selecting a doc and clicking a button on your page, the user is allowed to download the doc while still being left on your original page. if so, how about creating a button that calls a javascript procedure that checks the value of your select list and returns a rendering of that image? if that's what you're after, you could do it by adding javascript like...
    <script language="JavaScript" type="text/javascript">
    function viewSelImage (theItem)
    var selVal = document.getElementById(theItem).value;
    var url;
    url = 'getmyfile?p_id=' + selVal;
    location.href=url;
    </script>
    ...which, of course, assumes your document download procedure is publicly executable and named "getmydoc". it also assumes that getmydoc accepts p_id which corresponds to your document table. then, assuming your select list item is called P1_MY_IMAGE_IDS, you could add a button to your page that has a URL target of...
    javascript:viewSelImage('P1_MY_IMAGE_IDS');
    ...and that would popup a call to your document download procedure while leaving the user on the same page... which i believe is what you're after.
    hope this helps,
    raj

  • 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

  • Downloading blob content from a custom table

    In our hosted Apex application, the following code from the Application Express Developer's Guide works great for allowing a user to download blob content from one of our custom tables via a download button. However, the code doesn't work on the Oracle Cloud because the "owa_util" package is no longer available. The code is as follows:
    CREATE OR REPLACE PROCEDURE download_my_file(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 file_subjects
    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_my_file;
    Besides using web services, does anyone know of a way to do this? Is there a way to add access to the "owa_util" package in the cloud? I have also tried apex_util.get_blob_file_src but that is also unavailable in the Oracle Cloud.
    Thanks,
    Steve

    Following Joel's advice:
    The way I solved this was to split the code between two page processes and one application process. The download button first calls a page process to move the report data into a blob column and then calls another page process which is of "run application process" type. This calls the application level process where the download code, shown below, is called.
    Notice the following changes to the code from the one posted earlier (also from Joel)
    1) added sys.htp.init;
    2) "sys." to all htp, owa and wpg_docload calls
    3) added apex_application.stop_apex_engine; after the wpg_docload statement at the bottom of the script.
    Now the download button launches a "save as" dialog box and the report content is downloaded to the client.
    The code now looks like:
    CREATE OR REPLACE PROCEDURE download_my_file(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 oehr_file_subject
    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
    sys.htp.init;
    sys.owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
    -- set the size so the browser knows how much to download
    sys.htp.p('Content-length: ' || v_length);
    -- the filename will be used by the browser if the users does a save as
    sys. 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
    sys.owa_util.http_header_close;
    -- download the BLOB
    sys.wpg_docload.download_file( Lob_loc );
    apex_application.stop_apex_engine;
    end download_my_file;
    Thanks Joel for your help.
    Steve

  • BLOBs from different tables on one report

    Hi,
    I think the declarative BLOB support enhancement in 3.1 is really great. I am running into a problem with a report that joins two tables that both have BLOB columns. I have a Letters table and a Response table. The Response table has a FK linkage to the Letters table with the Letters table being the referenced table. I have a report that joins the Letters & Response tables and provides download links for the BLOBs in both tables. However on the report, only one of the link works at a given point in time. Both the links work fine in isolation (if the other link is commented out in the query).
    I am using the APEX_UTIL.GET_BLOB_FILE_SRC function to download the files. Has anyone tried using this function to download files from two different tables in a single report?
    TIA,
    Ramesh

    Ramesh,
    Is this application on apex.oracle.com by any chance? I just went to test there and am having all sorts of trouble with declarative display of BLOBs in a report but on our dev box, two works fine (except that the link for both is the default rather than what I selected).
    -- Sharon

  • Download data from interactive report

    Hi all. I'm on apex 3.1.1.00.09.
    I have this problem: when I download data from interactive report I can download only in CSV and PDF. If I try to download into pdf it creates a file of only 1 KB.
    I would know if I must configure my apex in order to download correctly in pdf and if I must configure it in order to download in doc and xls format.
    Thanks all for collaboration,
    Fabrizio

    Thank you for your reply.
    I am able to download the csv file, but my problem is: I don't want the column headings to show.
    Is it possible to download only the data, not the column headings?

  • Downloading data from a BLOB Field using mod_plsql

    Hi,
    I am trying to use the mod_plsql to download data from a blob field, I have a web page where I can pick the file name to be downloaded from the documents table This table has the BLOB field that has the Data formatted in a text file format(contains carriage returns), when I open it up in the browser it is displaying it correctly , but when I right click on the file name and choose "Save Target As" and save it as text file it is ignoring the carriage returns and displaying entire blob in one line.
    Can somebody help me figure out why it's not recognizing the carriage returns?
    Any help would be greatly appreciated.
    Thanks

    Hi and welcome to the forum.
    Is there a way to retrieve data from a blob field and save it to temp table.Why would you want to do that?
    Can you provide some more details regarding your requirement?
    (Don't forget to mention your database version as well)
    Also, I wonder why you've added a 'decompress' tag to your question?
    edit, after seeing Tubby's reply
    Dang, the connection must be frozen here ;)
    Edited by: hoek on Jan 6, 2010 9:06 PM

Maybe you are looking for

  • BT Broadband suddenly very slow on Mac OS X 10.5.8

    Hello, I'm posting on behalf of my dad as his broadband is now so slow as to be almost unusable. He lives in the Suffolk countryside but should still be able to receive broadband speeds of up to at least 1.5mb/s on his local exchange. His BT broadban

  • Interactive pdf issue, text wont show up when playing the slidewshow

    I am having a hard time trying to figure out how i can add text on top of am mp4 file and making it work once exported as an interactive pdf. For some reason the mo4 plays fine but the text will not show up. It seems like it will work fine when i loo

  • Fieldpoint engine not updating after first value

    I'm using an FP-1000 and an FP-TC-120 with two thermocouples attached. I've successfully set everything up with Fieldpoint Explorer and the data updates perfectly. The problem is when I try and read the tag values using a VI in Bridgeview. I start th

  • Photo Booth Crashing

    Every time I try to boot up photo booth after a fresh install it crashes and closes immediately. I have tried to explore the DVD to install just Photo Booth but can not find it. Is there a way to JUST INSTALL Photo Booth? Thanks, Kevin

  • Remember Playback Position still broken in 3.1

    On a mac. Description of problem: 1. Mark a song to 'Remember Playback Position' 2. Connect iphone and sync song. 3. Remove iphone from cable. 4. Play song. 5. While song is playing, connect cable. 6. Sync iphone. 7. Remove iphone from cable. 8. Play