Download from BFILE problem

Hello,
I have the following problem:
1. I can upload PDF files into BFILE(s) - in the DATA_PUMP_DIR (dba_directories table)
2. The uploaded file can be opened/viewed with Adobe Acrobat Reader.
3. I use a stored procedure do download the PDF files from my browser.
4. the download works ok but the file can no longer be opened/viewed using Adobe Acrobat Reader.
5. I did a hex compare of 2 pdf files (the uploaded file and the downloaded file) and I think it is a CR vs CRLF conversion problem.
I am using Oracle 10g XE on a Linux box and Windows as a client. The upload/download is part of a APEX application.
This is the code used to download the BFILE:
Note: v_mime is set to 'application/pdf'.
        x_bfile := BFILENAME ('DATA_PUMP_DIR', p_file);
        DBMS_LOB.fileopen (x_bfile, DBMS_LOB.LOB_READONLY);
        -- 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 );
        -- the filename will be used by the browser if the users does a save as
        htp.p('Content-Disposition:  attachment; filename="'||substr(v_file_name,instr(v_file_name,'/')+1)|| '"');
        -- close the headers
        owa_util.http_header_close;
        BEGIN
            LOOP
                DBMS_LOB.READ (x_bfile,
                               n_size,
                               n_pos,
                               x_buffer);
                HTP.prn (UTL_RAW.cast_to_varchar2 (x_buffer));
                -- increment number of bytes read
                n_pos := n_pos + n_size;
            END LOOP;
        EXCEPTION
            WHEN NO_DATA_FOUND THEN
                NULL;
        END;Any suggestions?
Thanks,
Catalin Florean.

You could try using wpg_docload.download_file instead of htp.prn.
Here is part of the procedure I use for downloading MP3 files from BFILES:
                owa_util.http_header_close;
                dbms_lob.createTemporary(TBlob, true);  
                dbms_lob.open(Lob_loc, dbms_lob.file_readonly);
                dbms_lob.loadfromfile( TBlob, Lob_loc, dbms_lob.getlength(Lob_loc) );
                dbms_lob.fileclose(Lob_loc);
                -- download the BLOB           
                wpg_docload.download_file( TBlob );    
                dbms_lob.freeTemporary( TBlob );You would replace my Lob_loc variable with your x_bfile.

Similar Messages

  • Download from FileReference = Problem

    Hello,
    I want to create a button which allow you to download a file on the server but when I click on it, nothing happens. Can you help me? please
    Code :
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="1308" height="1496">
         <mx:Text y="35" text="Mon CV" horizontalCenter="0"/>
         <mx:List  id="listcv" y="82" height="70" dragEnabled="true" color="black" horizontalCenter="0">
             <mx:Array>
                    <mx:String>PDF</mx:String>
                    <mx:String>WORD</mx:String>
                    <mx:String>PAGES</mx:String>
             </mx:Array>
        </mx:List>
        <mx:Script>
             <![CDATA[
        import flash.net.URLRequest;
        import flash.net.FileReference;
                  private function downloadFile():void {
                        var fileRef:FileReference = new FileReference();
                        fileRef.download(new URLRequest ("src/images/CV.pdf"));
              ]]>
        </mx:Script>
        <mx:Button y="160" label="Télécharger" click="downloadFile()" id="bouton" horizontalCenter="0"/>
    </mx:Canvas>
    Thank you

    You could try using wpg_docload.download_file instead of htp.prn.
    Here is part of the procedure I use for downloading MP3 files from BFILES:
                    owa_util.http_header_close;
                    dbms_lob.createTemporary(TBlob, true);  
                    dbms_lob.open(Lob_loc, dbms_lob.file_readonly);
                    dbms_lob.loadfromfile( TBlob, Lob_loc, dbms_lob.getlength(Lob_loc) );
                    dbms_lob.fileclose(Lob_loc);
                    -- download the BLOB           
                    wpg_docload.download_file( TBlob );    
                    dbms_lob.freeTemporary( TBlob );You would replace my Lob_loc variable with your x_bfile.

  • Download from otn problem

    dear all, when try to downlaod from http://otn.oracle.com/software/products/ias/workflow/htdocs/winsoft.html
    every download is 31.5 kb which is wrong i need to do the download.
    what is the prblem
    fadi

    Sorry if the documentation is slightly misleading, I'll try and clarify.
    After refreshing the Repository you should see a number of folders. Click on the 'For Our Employees' and there should be various sub folders, these should be the ones you need.
    We'll make sure to change the documentation for the next release and once again sorry for any confusion caused

  • I can't download from app store apps. if i try then open account and ask me shange payment type because there is a billing problem with a previous purchase. I download one game 0.99 and nothing more! help me. How can i contact with apple?

    I can't download from app store apps. if i try then open account and ask me shange payment type because there is a billing problem with a previous purchase. I download one game 0.99 and nothing more! help me. How can i contact with apple?

    Click here and ask the iTunes Store staff for assistance.
    (102938)

  • Problem with ID and download from app store:computer or device could not be verified

    Hello.I have mac and i had one game from app store,but one day i couldnt open it,it ased me to ented my App ID and password,,,i did but it wrote to meYour device or computer could not be verified. Contact support for assistance. I allready chande my password and mad ned ID but nothing works.....the same problem.how can i download from app store again.thanks

    Try a forum more suited:
    https://discussions.apple.com/community/mac_app_store/using_mac_apple_store?view =discussions

  • I am trying to download from iTunes and when I clicked on the Sync button, it indicates that it is waiting to start and then says the sync failed.  what is the problem

    Trying to download from iTunes and when I clicked on the Sync button, it indicates that it is waiting to sync.  Then it comes back saying sync failed.  What is the problem ?

    Few questions..
    are you using windows or mac?
    what version of itunes are you using?
    have you EVER been able to successfully sync with itunes?
    what iOS version are you running on your phone?
    This is a great article for syncing with itunes. Good Luck
    http://support.apple.com/kb/HT1386?viewlocale=en_US

  • Problem with pdf display downloaded from application server

    Hi all,
    I have a problem with displaying pdf downloaded from application server (saved in BINARY MODE).
    I am getting the pdf output of adobe form in FPFORMOUTPUT-PDF as rawstring back to my program and then converting that rawstring into binary form using the function module SCMS_BINARY_TO_STRING.
    Now, when I export the data to presentation server directly using cl_gui_frontend_services=>gui_download, the pdf is downloaded properly.
    However, when I save the data to application server file by looping at the internal table obtained from SCMS_XSTRING_TO_BINARY and using TRANSFER, and subsequently downloading the file in "unconverted format" from AL11 to my desktop, I am getting a "blank" pdf file (with the same number of pages as the one downloaded using gui_download).
    I have tried different encodings during download but in those cases i get corrupted pdf message. only the default option of INTIAL value seems to work.
    I am forced to believe that there is a problem in my code which saves the data to app server but I cant find any solution that is logical. Any solution to this would be greatly appreciated.
    Regards,
    Sasi
    Edited by: Sasi Upadrasta on Sep 29, 2010 7:55 PM

    used a program to read the file from appl server and then downloading it to desktop.

  • Windows 8.1 account limit problem when downloading from store

    windows 8.1 account limit problem when downloading from store        
    I have 250 windows 8.1 tablets.
    I figured since you can use the same account on 81 devices id create 4 accounts.
    I need to download more than 25 free apps from the store
    on each tablet. Putting the same account don't work. (comes up with an error after putting on to many devices that you cant use this account now).
    Whats the best way to do this ? and what if I need to download a paid app ?
    Thank You.

    Hi,
    As far as I know, One Microsoft Account may bound at most five Trusted computers. There is no way to break this limitation.
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • I run Tiger OSX on one MacBook and SnowLeopard on another. Photos were downloaded from Tiger to SnowLeopard, and now iPhoto won't open on the Tiger Mac. Will upgrading iPhoto fix this problem?

    I run Tiger OSX on one MacBook and SnowLeopard on another. Photos were downloaded from Tiger to SnowLeopard, and now iPhoto won't open on the Tiger Mac. Will upgrading iPhoto fix this problem?

    What matters is the version of iPhoto you have on the different machines. Can you tell us what they are, and what exact error message you get.
    Regards
    TD

  • I have a problem that I can not load or even close the download in iTunes, it turns out I have hanging in the mode, and because of that I can't download from AppStore, because it turns out that the other programs I have on standby. What do I do? Thank you

    I have a problem that I can not load or even close the download in iTunes, it turns out I have hanging in the mode, and because of that I can't download from AppStore, because it turns out that the other programs I have on standby. What do I do? Thank you.

    If there are multiple apps trying to download at once, only one can download at a time and the rest say "Waiting" until it is then their turn. Try this. Double tap the icon of the Waiting app, and it should resume the download.
    If that doesn't work:
    •  Log out of your iTunes store account.  Go to Settings > Store > Sign Out Then press the Home button.
    • Then press and hold the Home and Sleep buttons simultaneously and don't release them when it brings up the Turn Off screen; keep holding them until the Apple logo appears.
    • After restart, the Waiting should be gone.
     Cheers, Tom

  • When downloading from a Sony minidisc video camera, the picture is downloading but without sound.  Previously, it had downloaded successfully both sound and picture.  I have subsequently upgraded to Lion X (10.7.4).  Is there some problem with the driver?

    When downloading from a Sony minidisc video camera, the picture is downloading but without sound.  Previously, it had downloaded successfully both sound and picture.  I have subsequently upgraded to Lion X (10.7.4).  Is there some problem with the upgrade which is affecting the transfer?  Is there a way of resolving this?

    When you have kernel panics, the pertinent information is in the panic report.
    These instructions must be carried out as an administrator. If you have only one user account, you are the administrator.
    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad and start typing the name.
    In the Console window, select
              DIAGNOSTIC AND USAGE INFORMATION ▹ System Diagnostic Reports
    (not Diagnostic and Usage Messages) from the log list on the left. If you don't see that list, select
              View ▹ Show Log List
    from the menu bar.
    There is a disclosure triangle to the left of the list item. If the triangle is pointing to the right, click it so that it points down. You'll see a list of reports. A panic report has a name that begins with "Kernel" and ends in ".panic". Select the most recent one. The contents of the report will appear on the right. Use copy and paste to post the entire contents—the text, not a screenshot.
    If you don't see any reports listed, but you know there was a panic, you may have chosen Diagnostic and Usage Messages from the log list. Choose DIAGNOSTIC AND USAGE INFORMATION instead.
    In the interest of privacy, I suggest that, before posting, you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if it’s present (it may not be.)
    Please don’t post other kinds of diagnostic report.
    I know the report is long, maybe several hundred lines. Please post all of it anyway.

  • Problem in Font when file is downloaded from query output

    Hi,
    We are facing a problem as we are not able to simulate a scenario at our end where a file is downloaded from a query. The snapshot of the file which is downloaded in excel is shown below. The name displayed below has special characters in it. The actual value for the name is VÁRADI GÁBORNÉ, but when the file is downloaded into excel, the special characters get converted to some different characters and the last character ie É gets converted to “?” and the values for the next column get concatenated to the Name 1 column and all the values move one column left.
    Sold to     Cl     Name 1                                      Sal.per.     Sales doc.
    57983     CD     V&#32629;ADI G&#32603;ORN?00002110       2150451     
    57983     CD     V&#32629;ADI G&#32603;ORN?00002110       2150451     
    The procedure used by the user to download the file from the query is as follows:
    1.     The query is executed in background with file name entered in Save with ID option
    2.     After the job is complete, the file is displayed from the saved list of that query.
    3.     This saved list is then downloaded as .DAT file and then opened with excel.
    Any pointers to solve the problem will be highly appreciated.
    Regards,
    Kaushal Mehta

    Hi,
    There is no problem of device type as when we are testing the query with the same inputs (same variant, same printer), the output to the excel comes correctly. But at the user end, the output does not come out properly. Infact the saved list displayed for that query shows the output to be correct, but when that list is exported to excel, the output gets distorted for the user (not for us).
    Thanks for your inputs,
    Kaushal

  • IOS 8.0.2 Problems downloading from Apple Store

    We upgraded IOS 8.0.2 then purchased an iBook.  Downloading is stalled for hours.   Tried an upgrade in the App Store and same problem.  Downloading is stalled.  Is anyone experiencing similar problem with downloads from Apple Store?

    Hi there sheuston,
    You may want to try force closing all open apps and resetting the device as an initial troubleshooting step. Take a look at the articles below for more information.
    iOS: Force an app to close
    Turn your iOS device off and on (restart) and reset
    -Griff W. 

  • I always update my iPad without any problem , but this time for the iOS 7 , it is still downloading from yesterday more than 24 hours and as a result I can't open any email . So can you help me or tell me what went wrong

    I always update my iPad without any problem , but this time it didn't work out . My iPad 4 is still downloading from yesterday and I can not meanwhile open any website or any mail . Can you tell me what went wrong ??

    Try reset iPad
    Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears
    Note: Data will not be affected.

  • What is the problem in my account I could not download from the store, whether programs are free or non-free I hope you fix the problem or Chrho me and I repaired the problem

    What is the problem in my account I could not download from the store, whether programs are free or non-free I hope you fix the problem or Chrho me and I repaired the problem
    thank you...

    Nobody here can fix your problem, we do not work for Apple. And I have no idea what "Chrho" means. Neither does Google.
    So - exactly what happens when you try to download a program? And from where are you trying to download it?

Maybe you are looking for

  • Oracle XE 10g R2 on Windows 2003 Server SP1

    Hello, after a new installtion i can logon into the DB Homepage. But with the sys/system user i can´t see the databaseobjects like tables, sequences ond so on. The Cursor is still a sondbox in the browser and nothing happend. I have detect this probl

  • Companion Link

    I upgraded to DM 6 and Companion Link 4.0 to sycn my 9000 with Goldmine 7. I sync from GM to BB only. Here's what happened during sync: Cleared Appointments reappeared on my GM calendar. (this should be impossible); sync ran for over 3 hours (normall

  • Iphoto import creating and importing duplicates/ios8

    I'm using iphoto 9.4.3 and my iphone 5s with ios8.  Since septemberish (ios8 update), it's been double-importing all my pix on from my iphone - none are showing up as duplicates on the phone but import/iPhoto view shows and imports them all twice.  A

  • Does anyone have trouble watching youtube on Safari?

    Whenever i try to load a video, it just stays black, and no video follow. This onyl happens when I watch youtube on safari. My other browser, google chrome works just fine. Do anyone else face the same problem? Is there any way to rectify it?

  • Run PCA Assessment Cycle under New GL

    I'm on ECC6.0, and I'm trying to run PCA assessment cycle using FAGLGA15, I've created the PCA assessment cycle. But I got the warning message saying " no valid sender found", I checked table FAGLFLEXA, the sender profit center has values which I pos