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!

Similar Messages

  • Problem with downloading file from FTP server

    Hello all
    I have uploaded a file from an application i developed and i want to download this file from another application. The code is
    public static void FTPcon() throws FtpException{
       String hostname = "my.ftp.server";
       String username = "myusername";
       String password = "mypass";
       Ftp ftp = new Ftp(hostname,username,password);
       ftp.setHostname(hostname);
            ftp.setUsername(username);
            ftp.setPassword(password);
            ftp.connect();
            ftp.setBinary();
            ftp.download("file.dat");
            ftp.disconnect();
    }The error i receive is java.io.FileNotFoundException: public.dat (The system cannot find the file specified) but the file is on the server.
    Thanks in advance for any help

    Cotton thank you for your reply
    Any other sugestions please?The server disagrees. So...
    - the file does not existThe file exists.I checked it with an FTP client program.
    - the file has a different nameThe file name is correct
    - you are connected to the wrong serverI am connecting to the correct server
    - you are in the wrong ftp directoryThe file is placed in the home directory
    - the ftp library you are using is broken (less
    likely)I am using the library from jscape.I dont think is broken because i can upload the file from the first application.
    >
    FTP isn't somehow broken in Java. I use it all the
    time. The problem is something listed above. I would
    check all of the first four if I were you because
    that's most likely where the problem is.Message was edited by:
    flightcaptain

  • Problems with downloading files from the internet?

    I have Mozilla Firefox and Safari on my macbook. For some reason it will not let me download things from the internet. Whenever i keep a download link, the page never loads....can anyone put some insight into my problem?
    Justin Evans

    Since a few hours, I have the same problem like you. I uninstalled Firefox, because I thought it was a problem with it, but then i started Safari to redownload Firefox and guess what happened.. nothing. I can't download anything. don't know why. does anyone know whats wrong??

  • Problem with NEF files from Nikon D4

    Hi everyone. I find a problem with nef files from my Nikon D4. When files are open in ViewNX2 (free viewer software from Nikon) they are perfect, as shooted... but in ACR they are very different... I use LR4 or CS5 with ACR 6.7 and the difference seems to be linked at D-Lighting function. My impression is that ACR dont read this option and picture are very very dark that original shootings. Anyone have this problem?

    This question used to be answered in the FAQ before they revised it.  So, here we go again.  ViewNX is capable of reading all of the in-camera settings such as, camera profile, saturation, sharpness and other settings.  It is capable of doing this because it is Nikon Software, and they have the ability to program it to read the settings from their raw images.  Lightroom does not read those settings from Nikon cameras or any other brand of camera.  Part of the reason is that different camera makers store those settings differently.
    When I first started using Lightroom I adjusted one of my images that represented what I normally shoot until it looked the way I wanted it.  Then I saved those adjustments as my default settings for the camera.  From that point onward, whenever I import images those settings are automatically applied, and it takes care of the vast majority of my images.  Of course, I still have to make individual adjustments.  But my default settings greatly reduce the amount of how they work that I have to do.
    Active D-lighting is is one of those features that Lightroom does not recognize.  You would be well advised not to use it, or else create a preset to simulate its effect.  It will provide no benefit to your Lightroom work.
    This is a fundamental difference with Lightroom, and something that must be understood and implemented if you are going to use the program effectively.
    I realize this question was asked in the ACR forum and I referenced Lightroom throughout.  But the principle is the same, and the recommended procedure is the same.

  • I am facing a Problem with reading images from database

    Hi everybody..
    any help will be most appreciated, I am facing problem with reading images from database. I am pasting my code... 
                    string connect = "datasource = localhost; port = 3306; username = root; password = ;"; 
                    MySqlConnection conn = new MySqlConnection(connect); // creating connecting string
                    MySqlCommand sda = new MySqlCommand(@"select * from management.add_products ", conn); //creating query
                    MySqlDataReader reader; 
                    try
                        conn.Open(); // Opening Connection
                        reader = sda.ExecuteReader(); // Executing my Query..
                        while (reader.Read())
                            byte[] imgg = (byte[])(reader["Picture"]);
                            if (imgg == null)
                                pc1.Image = null;
                            else
                                MemoryStream mstream = new MemoryStream(imgg);
                                pc1.Image = System.Drawing.Image.FromStream(mstream);
    It says Parameter not Valid... i am reading all the images from database

    I agree with Viorel. You are getting the error because the format of the data is incorrect probably because the data was modify. It may not be the reading of the database the is incorrect, but the application that wrote the data into the database. You need
    to compare the imgg array data with the data before it was written to the database to see if the data matches.  I usually start by comparing the number of bytes which is easier to check then compare the actual to isolate which function is changing the
    byte count.
    An image is binary data.  The standard VS methods for reading and writing data (usually stream classes) default to ASCII encoding which will corrupt binary data.  The solution usually is to use UTF8 encoding instead of the default ascii encoding. 
    Ascii encoding with stream often aligns the data and adds extra null bytes to the end of the data which can produce these type errors.
    jdweng

  • I just stared having problems with importing files from nikon D810 into LR 5.7 it pop a window saying it can not read files on working on a imac 27" running yosemite on my mac pro after a few times it finally was able to read files and import them into LR

    I just stared having problems with importing files from nikon D810 into LR 5.7 it pop a window saying it can not read files on working on a imac 27" running yosemite on my mac pro after a few times it finally was able to read files and import them into LR I never had this problem before was there some kind of update that could of cause this?

  • Problem with downloading files!

    Hi, I am using a9300 MTN as my service provider! Lately I cannot download or open any files on the internet! I hav rebooted my phone numerous times and the problem still persists! Cud it be a software issue or is my service provider having trouble with providing internet service to us! Help!! Really getting frustated!!☹
    Solved!
    Go to Solution.

    Hey kgaoza12,
    Welcome to the BlackBerry Support Community Forums.
    Thanks for the question.
    Downloading files from the browser is controlled and throttled by your network service provider.  I suggest you contact them for more information.
    Let me know if you have any more questions.
    Cheers.
    -ViciousFerret
    Come follow your BlackBerry Technical Team on Twitter! @BlackBerryHelp
    Be sure to click Like! for those who have helped you.
    Click  Accept as Solution for posts that have solved your issue(s)!

  • Ok ..problems with downloading music from itunes to cd...it doesn't give me a burn botton to push...HELP!!

    problems with getting music from itunes to a cd...thr isnt a option to push burn like thr was a few wks ago whn i did this..and i have recently download the new itunes 10.4....so y cnt i get a burn botton to show up so i can burn me a cd???  HELP!

    File>Burn Playlist to Disc

  • Swing Applet in JSP: problem with fetching data from database

    i am facing a problem while fetching data from database using Swing Applet plugged in a JSP page.
    // necessary import statements
    public class NewJApplet extends javax.swing.JApplet {
    private JLabel jlblNewTitle;
    private Vector vec;
    public static void main(String[] args) {
    JFrame frame = new JFrame();
    NewJApplet inst = new NewJApplet();
    frame.getContentPane().add(inst);
    ((JComponent)frame.getContentPane()).setPreferredSize(inst.getSize());
    frame.pack();
    frame.setVisible(true);
    public NewJApplet() {
    super();
    initGUI();
    private void initGUI() {
    try {
    this.setSize(542, 701);
    this.getContentPane().setLayout(null);
    jlblTitle = new JLabel();
    this.getContentPane().add(jlblTitle);
    jlblTitle.setText("TITLE");
    jlblTitle.setBounds(197, 16, 117, 30);
    jlblTitle.setFont(new java.awt.Font("Dialog",1,20));
    jlblNewTitle = new JLabel();
    this.getContentPane().add(jlblNewTitle);
    Vector vecTemp = getDBDatum(); // data fetched fm DB r stored here.
    jlblNewTitle.setText(vecTemp.get(1).toString());
    jlblNewTitle.setBounds(350, 16, 117, 30);
    jlblNewTitle.setFont(new java.awt.Font("Dialog",1,20));
    } catch (Exception e) {
    e.printStackTrace();
    }//end of initGUI()
    private Vector getDBDatum() {
    // fetches datum from oracle database and stores it in a vector
    return lvecData;
    }//end of getDBDatum()
    }//end of class
    in index.jsp page i have included the following code for calling this applet:
    <jsp:plugin type="applet" code="NewJApplet.class" codebase="applets"
    width="600" height="300">
    <jsp:fallback>Could not load applet...</jsp:fallback>
    </jsp:plugin>
    if i view it in using AppletViewer it runs perfectly and display the data in JLabel. (ie, both jlblTitle and jlblNewTitle).(ie, DATA FETCHES FROM db AND DISPLAYS PROPERLY)
    BUT IF I CLICK ON INDEX.JSP, ONLY jlblTitle APPEARS. jlblnNewTitle WILL BE BLANK(this label name is supposed to fetch from database)
    EVERY THING IS DISPAYING PROPERLY EXCEPT DATA FROM DATABASE!!!
    i signed the applet as follows :
    grant {
    permission java.security.AllPermission;
    Can any body help me to figure out the problem?

    This is the Swing Applet java code
    import java.awt.Dimension;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.Vector;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.JScrollPane;
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTree;
    import javax.swing.ScrollPaneConstants;
    import javax.swing.SwingConstants;
    public class HaiApplet extends javax.swing.JApplet {
         private JLabel     jlblTitle;
         private JLabel     jlblNewTitle;
         private Vector     vec;
         * main method to display this
         * JApplet inside a new JFrame.
         public static void main(String[] args) {
              JFrame frame = new JFrame();
              NewJApplet inst = new NewJApplet();
              frame.getContentPane().add(inst);
              ((JComponent)frame.getContentPane()).setPreferredSize(inst.getSize());
              frame.pack();
              frame.setVisible(true);
         public HaiApplet() {
              super();
              initGUI();
         private void initGUI() {
              try {               
                   this.setSize(542, 701);
                   this.getContentPane().setLayout(null);
                        jlblTitle = new JLabel();
                        this.getContentPane().add(jlblTitle);
                        jlblTitle.setText("OMMS");
                        jlblTitle.setBounds(197, 16, 117, 30);
                        jlblTitle.setFont(new java.awt.Font("Dialog",1,20));
                        jlblTitle.setHorizontalAlignment(SwingConstants.CENTER);
                        jlblTitle.setForeground(new java.awt.Color(0,128,192));
                        jlblNewTitle = new JLabel();
                        this.getContentPane().add(jlblNewTitle);
                        Vector vecTemp = getDBDatum();
                        jlblNewTitle.setText(vecTemp.get(1).toString());
                        jlblNewTitle.setBounds(350, 16, 117, 30);
                        jlblNewTitle.setFont(new java.awt.Font("Dialog",1,20));     
              } catch (Exception e) {
                   e.printStackTrace();
         }//end of initGUI()
         private Vector getDBDatum() {
              Vector lvecData = new Vector(10,5);
              Connection lcon = null;
              Statement lstmt = null;
              ResultSet lrsResults = null;
              String lstrSQL = null;
              String lstrOut = null;
              try {
                   OmmsDBConnect db = new OmmsDBConnect();
                   lcon = db.connectDb();
                   lstmt = lcon.createStatement(lrsResults.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
                   lstrSQL = "select DT_ID from P_DATATABLES";
                   lrsResults = lstmt.executeQuery(lstrSQL);        
                   int i = 0;
                   lrsResults.last();
                   int length = lrsResults.getRow();
                   System.out.println(length);
                   lrsResults.beforeFirst();
                   int recCount = 0;
                   while (lrsResults.next()) {
                        recCount++;
                        lvecData.addElement(new String(lrsResults.getString("DT_ID")));
                   //     System.out.println("ID :  " + lrsResults.getString(1));
                        i++;
                   }System.out.println("here 3 out fm while");
              catch(SQLException e) {
                   System.out.print("SQLException: ");
                   System.out.println(e.getMessage());
              catch(Exception ex) {
                   lstrOut = "Exception Occured " + ex.getMessage();
              finally {
                   try {
                        lrsResults.close();
                        lstmt.close();
                        lcon.close();
                        System.out.println("[DONE]");
                   catch(Exception e) {
                        System.out.println(e);
             }//end of finally
              return lvecData;
         }//end of getDBDatum()
    }//end of classOfcourse the above code compiles and runs well. in Applet Viewer
    I plugged the above Swing Applet in a JSP page index.jsp
    <jsp:plugin type="applet" code="NewJApplet.class" codebase="applets"
                   width="600" height="300">
         <jsp:fallback>Could not load applet...</jsp:fallback>
    </jsp:plugin>Every thing is working fine in AppletViewer...But if i view this in any browser, then only the jlblTitle is displaying. jlblNewTitle is not displaying(this label name is actually fetching from thedatabase)
    can any body help me regarding this matter.? Thx in Advance.

  • Help required with downloading files from inside WEB-INF folder

    I am working on a web application and I have an upload script which uploads different files to a foler called 'uploads' . To stop users from accessing the folder content I have put it in the /WEB-INF/.
    In my JSP file, I used to link to the uploaded files like this before for users to download them :
    if(filesListIterator.hasNext()
    files = (FilesBean)filesListIterator.next();
    <tr><td><a target="_new" href="<%=files.getFileName()%>">"<%=files.getFileName()%></a></td></tr>
    }I need to know how to alter the above link to make it access/download files from the /WEB-INF/uploads/ while still restricting direct access to the files.
    Thanks
    Message was edited by:
    topiwal

    Anything under WEB-INF is not directly accessible via the browser/ client. You could try defining the JSP/ Servlet inside web.xml deployment descriptor and see if you can access the file from there.
    I think a better way to accomplish this would be to keep the file outside WEB-INF , and use other techniques to protect the folder that contains the file - for example password-protection, or defining a .htaccess file and serving a 403 Forbidden error.

  • Problem in download file from FTP server

    Hi
    I want to download a file from FTP server for that i am using the apache FTP module but i am not getting how to download a file with that api i can dispaly the list of files and folders but not able to download the file or folder can any one help me in this
    Thanks
    Ninad

    Hi
    I think you miss understood something I am writing a program to download the file in Java where i have used the jakarta.apache api for that and getting problem in that bellow is the code where I have written to print the directory & file names but I don't know how to download the file
    FTPClient ftpConnection = new FTPClient();
    ftpConnection.connect(host);
    ftpConnection.login(FTPConnection.userName,FTPConnection.password);
    FTPFile fileList[] = ftpConnection.listFiles();
    for(int i=0;i<fileList.length;i++)
         System.out.println(fileList.getName());
    thanks
    Ninad

  • Problem while downloading file from custom table

    Hi All,
    Im trying to download the file from the custom table where i have stored the uploaded files through apex.
    I have created the download procedure as mentioned in the oracle docs ,
    And given the execute grant for public user.
    and calling that procedure by calling the URL -- #OWNER#.download_my_file?p_file=#ID#
    But im getting the below error
    Forbidden
    You don't have permission to access /pls/apex/owner.download_my_file on this server.
    Oracle-Application-Server-10g/10.1.2.0.2 Oracle-HTTP-Server Server at servername Port number
    Can any one tell whats the problem here.
    Thanks in advance
    regards,
    Arumugam KR

    Your function apex_util.get_blob_file_src under region, the first argument must be the name of page item anywhere in your application that is of type "file browse." So if your form for uploading the blob content is on page 11 and the file browse item is "P11_FILE_NAME" then your query would look like below:
    SELECT FILE_ID
         , FILE_NAME
          , CASE WHEN NVL(dbms_lob.getlength(BLOB_CONTENT),0) = 0
           THEN NULL
            ELSE
                  CASE WHEN attach_mimetype like 'image%'
                THEN '<img src="'||apex_util.get_blob_file_src('P11_FILE_NAME',id)||'" />'
                ELSE
                     '<a href="'||apex_util.get_blob_file_src('P11_FILE_NAME',id)||'">Download</a>'
               end
           END new_img
        FROM TABLE_NAME
    GET_BLOB_FILE_SRC FunctionAs an alternative to using the built-in methods of providing a download link, you can use the APEX_UTIL.GET_BLOB_FILE_SRC function. One advantage of this approach, is the ability to more specifically format the display of the image (with height and width tags). Please note that this approach is only valid if called from a valid Oracle Application Express session. Also, this method requires that the parameters that describe the BLOB to be listed as the format of a valid item within the application. That item is then referenced by the function.>
    [url http://docs.oracle.com/cd/E14373_01/apirefs.32/e13369/apex_util.htm]GET_BLOB_FILE_SRC

  • 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

  • Problems with downloading videos from the internet....please help

    sorry if this the wrong forum to post but I don't know where else to post my issue.
    Normally when I download videos from the internet I click on "window" then "activity" then the largest file ie ? of ? (which is the MB file) and it downloads then I use isquint to put it to mp4 format. However now when I do that the file I download says that "video _ts folders can't be directly converted" and there is a button that says "Inadequacy". I can't even download videos from youtube. Any help would be great.
    thank you

    Other than the videos on YouTube, can you post a link or URL of the videos you having problems with for us to test out for you?
    I use Firefox which has quite a few video converter add ons that allows downloads of any type of video from the net. The one I use is called +Flash Video Downloader.+
    "Is there anything else I need to have installed in order to be able to download videos?"
    The latest versions of the following:
    QuickTime
    RealPlayer
    Flip4Mac
    VLC Media Player
    Perian (AVI and FLV support)
    "I also have divx and 3ivx installed"
    You can get rid of those if you have any of the above installed.
    " Mac OS X (10.5.2)"
    Use Software Update to update your OS which is seriously out of date. The last version of Leopard I believe was either v5.6 or v5.8. Also, update all the other things listed that pertain to the OS & your model computer if applicable to your needs.
    !http://i50.tinypic.com/izvwo1.gif!

  • Problem in downloading file from app server using CG3Y in to .XLS fomat

    hi All,
    I have uploaded file in to application server through a program using open data set with the separater as "|" ( pipe ) . Now the user should be able to download the file from apps server to presenataion server in .XLS format using txn CG3Y. but when we download, the format appears wierd and the data is not consistent across columns in excel. i.e the data which is supposed to be in one column in the excel is in the other column. what precautaions should i take  before moving data to apps server so that it will be downloaded in a good format.
    Appreciate your help...
    Regards,
    Sreekanth.

    Separate each values with TAB space present in the application server .
    Currently u r using | pipe character. Instead of that use CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB as delimiter.
    Each value will displayed in separate cells in excel sheet when u download it frm app.server
    Regards,
    Lakshman.

Maybe you are looking for

  • My ipad isnt restoring, error code 1611, is there a fix for this?

    Itunes no longer recognizes my ipad on my computer, I used my friends computer and it gets as far as restoring but says unable to restore rror 1611 Any help is much appreciated - windows 7- desktop - Ipad 1st gen

  • Spaces with Multiple Displays

    I have been using Spaces with my MacBook with an external display, without mirroring to extend my desktop. Overall, it works really well and has certainly made things less hectic when I have 1-8 windows open per application and up to 5 applications.

  • Could not find SMP 1.0 to download

    Hello, I've been looking to download SMP 1.0 from SAP service market place, But I could not find the installation software to download. I got only SMP 3.0, But when I tried to install it. It said we need to install SMP 1.0, service pack 1 to begin in

  • Template Bug? Not sure where to post. I have a sample.

    It seems that Dreamweaver 2004 MX (version 7.0.1 on Windows XP) gets confused if you create a page with invalid HTML. I've seen some other posts on this, but I'm not sure if it's been fixed. If you do the following, you'll get the popup warning "You

  • Use of Audit Trail in interface

    Hi All, I want to use audit trail in the existing ABAP -Hr interface , how can I do so . Thanks In Advance