Downloading files from database in Google Chrome and Firefox

I am using a modified version of  the get_doc to view files stored in the database.  I am able to use this code perfectly in Internet Explorer but attempting view the data in Firefox or Google Chrome opens up a page showing the data in a binary format.  I believe it may have something to do with the headers.  The code is as follows:
create or replace
package body          "PKG_FILES" is
PROCEDURE pr_open_file(p_table in varchar2, p_id in number, p_name in varchar2 DEFAULT null, p_content in varchar2 DEFAULT 'CONTENT') AS
     v_query        VARCHAR2(1000);
     v_mime         VARCHAR2(48);
     v_length       NUMBER;
     v_file_name    VARCHAR2(2000);
     v_table        VARCHAR2(100);
     Lob_loc        BLOB;
BEGIN
  v_table := p_table;
  v_query := 'SELECT MIME_TYPE,'|| p_content ||', FILE_NAME, DBMS_LOB.GETLENGTH('||p_content||') FROM '||v_table ||' WHERE '||v_table||'_ID = :id';
  EXECUTE IMMEDIATE v_query INTO v_mime,lob_loc,v_file_name,v_length USING p_id;
              -- 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 pr_open_file;
end "PKG_FILES";
Has anyone had this same issue or any ideas?

Before Little Bobby Tables logs into your application, make sure you read up on DBMS_ASSERT to ensure that the table name and column are valid DB objects before you dynamically create any SQL statements.
ie prevent SQL Injection.
Other than that, use APEX_DEBUG.MESSAGE() to spit out some information... like which MIME/TYPE you are using.
It could be that the value stored in the database table is invalid.
hint:  the ORDDoc data type could be used to detect the correct mime/type.
Finally, I've read somewhere that an APEX_APPLICATION.STOP_APEX_ENGINE() was needed at the very end of the process.
MK

Similar Messages

  • I just downloaded Google Chrome and use both Google Chrome and Firefox as my browser. However, whenever I click on an email link, it opens up Chrome and I want it to open Firefox. How do I fix this?

    I just downloaded Google Chrome and use both Google Chrome and Firefox as my browsers. However, whenever I click on an email link, it opens up Chrome and I want it to open Firefox. How do I fix this?

    Go into FF Preferences & set it to be your default browser.  This way when you click on an email link in Chrome, FF will open.

  • Hi i have bought new macbook pro for a few weeks ,,  Facebook and Twitter both won't open the page says safari can't find server for Facebook even google chrome and firefox booth won't open Facebook

    Hi i have a macbook pro retina,,,
    i have been using this  mac for 4 weeks ,,
    in some reason Facebook and twitter booth won't open for two weeks and all of the pages work perfectly fine
    i have safari Version 8.0.2 witch is the latest version for now
    even google chrome and firefox won't open Facebook and twitter
    i have mac os x 10.10.1

    You have 14 days to return the computer w/no questions asked.  Plus you have 90 days of FREE phone tech support on top of your standard 1 year warranty unless you also purchased AppleCare which gives you an additional 2 years of coverage plus FREE phone support.
    Strongly suggest that you take FULL advantage of the above before it runs out.  Let Apple deal w/the problems.

  • Google Chrome and Firefox won't open any sites. Internet explore can.

    Internet Explorer will run any sites. After installing google chrome and firefox its opens the browser but then when i enter a site, any site, it just wont go... It's not giving me an error message... i push the "enter" key and the busy locator, the circle thing that rotates to indicate the page is loading. it just pops for like 1 sec still remains on the main page.

    Hello justinmendoza89, check if your [https://support.mozilla.org/en-US/kb/configure-firewalls-so-firefox-can-access-internet#os=win7&browser=fx16 firewall] or other security software(antivirus, antispyware) prevent firefox access .
    [https://support.mozilla.org/en-US/kb/configure-windows-firewall-allow-firefox-access#os=win7&browser=fx16 Configure Windows Firewall to allow Firefox access to the Internet]
    thank you

  • I have just got an iMac 21" and it continuously freezes when it goes to sleep and also when the internet is trying to load, i have tried three different browsers but it still does it (safari, google chrome and firefox), does anyone know what is wrong?

    I have just got an iMac 21" and it continuously freezes when it goes to sleep and also when the internet is trying to load, i have tried three different browsers but it still does it (safari, google chrome and firefox), does anyone know what is wrong?

    To fix the freezing when sleeping problem go to System Preferences>Energy Saver and set 'Computer Sleep' to 'Never'. It seems there is a problem for some with Bluetooth failing to wake after sleep. This fixes it 100% for me and many others on here, until Apple issue a software update to address it.
    Not sure what to suggest on the internet problem. I assume you are connected and receive and send emails OK.
    Edit: To try to troubleshoot the internet issue maybe try turning the Firewall off: System Preferences>Security & Privacy>Firewall tab.

  • Favicon does not show up on Google chrome and firefox with new muse release. Opera showing favicon ok.

    Favicon does not show up on Google chrome and firefox with new muse release when exporting HTML or publishing with FTP. Opera showing favicon ok. Previews Muse release was working fine.
    this website was created with one update back BK Foto
    this one page was updated with latest updated Muse and after publishing with FTP through Muse favicon does not show up Paslaugų Era | Foto Video Paslaugos

    Export your HTML and then Just edit index.html with any text editor look for sentence <link rel="...................................>
    Then delete all this sentence and copy this one
    <link href="//PATH/favicon.ico" rel="shortcut icon" type="image/x-icon">
    PATH = Where you have your favicon.ico
    I usually copy the favicon.ico in the folder images so the sentence will be like this
    <link href="//mydomain.com/images/favicon.ico" rel="shortcut icon" type="image/x-icon">
    i hope it helps you
    Sorry about my english, my spanish is much better
    Juan Pedro Avila

  • MacBook pro battery drains fast w/ google chrome and Firefox

    When I pull up a website with a video, IE YouTube, my activity monitor shows significant usage even with only 1 tab open and the video not even playing (and if it's completely loaded). Google chrome had 2 things at 50% ( google chrome and renderer) AND the shockwave plug-in at 28-30%. Firefox just has the plug-in at around 35-40%. So basically my question is if this is normal and if not then what some remedies are?

    AppleMenu > About This Mac > More Info > Power
    This is mine ...
    What is your battery's "Condition"?

  • Infragistics gridview control sorts in Google Chrome and Firefox but not in IE11

    I have an Infragistics webdatagrid control on my website homepage that displays few information in form of rows. The code is as follows
    <asp:Panel ID="Panel" runat="server">
    <ig:WebDataGrid ID="UltraWebGrid" runat="server" oninitializerow="UltraWebGrid_InitializeRow"
    EnableRelativeLayout="false" HeaderCaptionCssClass="GridHeaderCaption"
    OnInit="UltraWebGrid_Init" onrowupdated="UltraWebGrid_RowUpdated" OnRowUpdating="UltraWebGrid_RowUpdating" OnColumnMoved="UltraWebGrid_ColumnMoved"
    EnableAjax="true" EnableAjaxViewState="true" EnableDataViewState="True" OnColumnResized="UltraWebGrid_ColumnResized" OnColumnSorted="UltraWebGrid_ColumnSorted">
    <Behaviors>
    <ig:Sorting >
    </ig:Sorting>
    <ig:ColumnMoving EnableInheritance="True">
    </ig:ColumnMoving>
    <ig:Filtering FilterType="ExcelStyleFilter">
    </ig:Filtering>
    <ig:ColumnResizing EnableInheritance="True" >
    </ig:ColumnResizing>
    <ig:EditingCore AutoCRUD="false">
    <EditingClientEvents CellValueChanged="UltraWebGrid_Editing_CellValueChanged" />
    <Behaviors>
    <ig:CellEditing>
    <CellEditingClientEvents />
    <EditModeActions EnableOnActive="True" MouseClick="Single" />
    </ig:CellEditing>
    </Behaviors>
    </ig:EditingCore>
    </Behaviors>
    </ig:WebDataGrid>
    </asp:Panel>
    The column is sorted accordingly when user clicks any column header. This happens in Chrome and Firefox but in IE we have a weird behavior as below
    Users complain that when they get to the home page for the first time , and they try to sort on the grid, the operation doesn’t get done. They need to go into a row before the sorting works, and after that everything is fine.
    Any idea or pointers would greatly help. 
    K.V.N.PAVAN

    Since this is a WPF forum I would suggest that you go to the Asp forum for help.
    http://forums.asp.net/
    Lloyd Sheen

  • I have an iMac with Mavericks that is experiencing a lot of "spinning balls" from particularly Mail, Google Chrome, and Word. I took it to the Apple store and it was fast there, at home slow. I have been having internet speed issues, could it be that?

    I have a pretty new iMac with LOTS of storage (about 4TB with externals) that is experiencing a lot of "spinning balls of death" from time to time in almost any program that I might have open, but particularly MacMail, Google Chrome browsers, and Word. I took it to the Apple store to be checked out and it was really fast with no issues there. I brought it home and it was better at first but then it started happening again.
    I have been having a lot of issues with Time Warner where my download speeds will dip really low, and all I can think of is that MacMail goes and tries to check for email and can't get out to the internet and it locks all the other resources up while it is doing it. It will also take a REALLY long time to even let you look at mail. The folder size is over 13GB (down from 22GB that I just cleared out from - I have a lot of MP3s etc in there) and I will try to get this down to under 10GB which might help, and the mail is on an external drive. I have been told that Verizon is not a shared network but a direct connection to their server, and if I can't fix this then I will try switching to them. If anyone has any direct knowledge on this stuff, I am all ears.

    We need to know more about your system, please download EtreCheck and run the report and please post it on your next reply. Then we can see how your system is configured, what apps are on it and look for anything obvious. We will look forward to seeing your report.

  • Problems with downloading file from database!

    I have a table with my files:
    NAME     VARCHAR2(256)
    LAST_UPDATED     DATE
    MIME_TYPE      VARCHAR2(128)
    DOC_SIZE     NUMBER
    DAD_CHARSET     VARCHAR2(128)
    CONTENT_TYPE     VARCHAR2(128)
    CONTENT     LONG RAW
    BLOB_CONTENT      BLOB
    ID     NUMBER
    I have a procedure which download file for it's ID:
    procedure DownloadFile(id number)
    is
    v_mime VARCHAR2 (48);
    v_length NUMBER;
    v_file_name VARCHAR2 (2000);
    lob_loc BLOB;
    i integer;
    BEGIN
    i:=id;
    SELECT d.mime_type, d.blob_content, d.NAME, DBMS_LOB.getlength(d.blob_content)
    INTO v_mime, lob_loc, v_file_name, v_length
    FROM documents d, mydocs m
    WHERE d.id=m.doc_id
    and m.id=i;
    -- 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;
    And when I press Download button, it open the file content in browser.
    But I need save dialog, for saving the file in the clien machine.
    How to solve this problem?
    Regards,
    Kostya!
    Message was edited by:
    Kostya

    How downloaded objects/document are treated in browser is purely "browser defined behavior". Sometime someone said that or these kind of files (recognized by miome contenet - alias file extension) default behavior will be "show inline" or show in browser. This is esspecially true for Adobe 7.x and IE 6.x and Firefox 2.x....
    For a test of my thoughts, install new browser (let say Opera or Mozila) and try to download LOB(doc). I'm sure that "Save As" dialog will show!
    Hope this helps!

  • Download file from database

    Hi
    I have try the "Downloading Documents from the Custom Table" from the guide:
    http://download-uk.oracle.com/docs/cd/B32472_01/doc/appdev.300/b32469.pdf
    I have made the Procedure and it works fine.
    I have now tryed to put the Procedure in a package, but it does not work?
    The link to the file is: #OWNER#.MY_PACKAGE.download_my_file?p_file=#ID#
    But I got the file is not found...?
    Would it work to put the Procedure in a package? or is it only a Procedure?
    Best Regrads
    Jesper Vels

    Hi
    I have try the "Downloading Documents from the Custom Table" from the guide:
    http://download-uk.oracle.com/docs/cd/B32472_01/doc/appdev.300/b32469.pdf
    I have made the Procedure and it works fine.
    I have now tryed to put the Procedure in a package, but it does not work?
    The link to the file is: #OWNER#.MY_PACKAGE.download_my_file?p_file=#ID#
    But I got the file is not found...?
    Would it work to put the Procedure in a package? or is it only a Procedure?
    Best Regrads
    Jesper Vels

  • Forms do not open correctly in Google Chrome and Firefox

    Does anybody know the reason for the bad performance of the Adobe form, which I have created from scratch using the available tools in Form Central?
    It only works in Explorer and Safari...
    Also, if saved as a pdf, users experience that the "send it" button is dysfunctional.

    Hi Josh
    If by webform you mean the version that is generated in Formcentral for embedding onto a website, your question is simple to answer.
    The problems I have described occurs when using this webform, which I have generated for embedding. I have found that it is easier to email the pdf version to the customer, because then they can open it in Adobe Reader.
    I have aslo found that the webform works in Safari and Explorer. In Firefox it opens without functioning fields, but firefox opens a line stating that the document is not shown correctly, and they give option to reopen in program of choice. If doing this in Adobe Reader, it works.
    In google chrome it just does not work...
    Maybe the webform should be rebuilt, or I should just forget about it and arrange a pdf download button instead?
    Morten

  • Update to the new release and firefox hangs and becomes unresponsive each time I try to open it. I have tried removing firefox from my pc, restarted my pc. went to Google Chrome and downloaded it again. Still hanging. Please help

    Update to the new release and firefox hangs and becomes unresponsive each time I try to open it. I have tried removing firefox from my pc, restarted my pc. went to Google Chrome and downloaded it again. Still hanging. Please help
    I can open Google Chrome and IE without any problems. My new version of Thunderbird won't let me see messages.

    So i have just unistalled itunes logged on to apple to try and download the itunes prog ,but it dont seem to have downloaded.can anyone help me please.
    Could you walk us through what happened when you tried to do the download, please?

  • Cannot open downloaded files from Firefox or IE, but can in Google Chrome?

    When I download files in Firefox and IE, it either fails to complete downloading them stating that they have some sort of virus, or they show complete but none of them actually save. When I try to open the link in the downloads window, they do nothing, and right clicking shows "Open" and "Open Containing Folder" are greyed out. I do not have any of these problems with Google Chrome, and I would rather use Mozilla. I have tried many basic fixes I have found and nothing seems to work.

    It is possible that your anti-virus software is corrupting the downloaded files or otherwise interfering with downloading files.<br />
    Try to disable the real-time (live) scanning of files in your anti-virus software temporarily to see if that makes downloading work.
    See "Disable virus scanning in Firefox preferences - Windows"
    *http://kb.mozillazine.org/Unable_to_save_or_download_files

  • Uploading and downloading files from a web app (Urgent!!)

    Hi everyone:
    I'm developing an application in PL/SQL to upload and download files from an HTML webpage. I congured the document table and the parameters necessary in the DAD of my application.
    when I upload the file using my webpage that file info is automatically uploaded to the doc table. This is as far as I have gotten.
    I need to do the following:
    - Place the uploaded file into a column in another table in my database as part of a text message (think of it as an email message), and delete the file from the doc table (as this is thought to be a temp table that holds the file when uploaded from my webpage)
    - Retreive the file so that it can be downloaded from another web page.
    The file can be a PDF, WORD DOC, etc...
    I now that I can do this with InterMedia but I haven't figured out how :(
    Can anyone please point me to an example or some documentation that can guide me through the process.
    DB VERSION: 8.1.7
    IAS VERSION: 1.0.2.2
    Thanks,
    Carlos Abarca

    The idea was for you to look at the code and get an idea of how to access the BLOB in the document table. IF you look at the procedure
    insert_new_photo( new_description IN VARCHAR2,
    new_location IN VARCHAR,
    new_photo IN VARCHAR2 )
    It shows how to access the blob that is stored in the document table. You can then copy this blob to your own table using the DBMS_LOB package.
    Hope this helps,
    Larry

Maybe you are looking for