Get Uploaded File Mime Type and Client Filename

Anyone know how to recover an uploaded file MIME type and
client file name?
I'm writing my own cfx tag to process file uploads and pretty
much have it figured out except to determine the name of the client
file and mime type. The formfield file variable value contains the
path/filename to the CF temp directory, but I need the MIME type,
filename, etc. that is contained int he HTTP Header
(e.g. Content-Disposition: form-data; name="Image";
filename="C:\test.JPG"
Content-Type: image/pjpeg
[empty line])
I'm using the getHttpRequestData() functiont, but it only
gives me the content-type multipart/form-data, leaving out the Mime
type and Content-Disposition (which contains the client file name).

Hi Daniel,
do you use EPG, mod_plsql or APEX Listener? Have you changed the connection mechanism after upgrading to 4.2.1?
If you use the APEX Listener, which version do you use? Which browser and version do you use to upload the file? Does it reproduce with other browsers as well?
Regards
Patrick
Member of the APEX development team
My Blog: http://www.inside-oracle-apex.com
APEX Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf

Similar Messages

  • Uploading files Mime Type not correct for Office 2007 default extensions.

    hi all,
    My company has recently moved over to MS Office 2007 and the default extensions for word, excel etc are now .docx, xlsx etc (ie xml based).
    Unfortunately now when we upload files through APEX to the database the MIME TYPE value for these files isn't being recognised and not loadeding correctly into the APEX_APPLICATION_FILES table and subsequently any future retrieval of these files fails.
    I could put some logic inthe up load procedure to look at the filename in APEX_APPLICATION_FILES and hard code in the releavnt mime types but this still causes problems when retrieving the content.
    Has anyone come across this and got a workround? Is it a bug in AE?
    regards
    James
    FYI - using APEX 3.0.2 over 11G.

    I have not any response to my question and not sure if it is in Apex I need to look or the tomcat server that I need to look. I have a useful application to try to show others what Apex can do for our customers to collaborate. However, most of our customers are using office 2007 so, hoping this is possible.
    I am using apex 3.2.0.00.27 if that helps someone to point me where to find more info on being able to have Word 2007 or excel 2007 fire up to open a .docx or .xlss file stored in a table blob column. Word or Excel does fire up to open .doc and .xls files.
    The following is the query for a report selecting the filenames uploaded into a blob column in my table:
    { SELECT s.ID, SUBSTR(s.NAME,INSTR(s.NAME, '/',1,1)+1,length(s.NAME)) SHORT_FNAME, s.SUBJECT
    FROM spp_attachments s
    WHERE s.PROGRAM_ID = :P2_PROGRAMID }
    Below is the stored procedure called from the link on the short_fname column in report query above.
    { create or replace PROCEDURE  download_file(p_file IN number) AS
    v_mime VARCHAR2(48);
    v_length NUMBER;
    v_file_name VARCHAR2(2000);
    Lob_loc BLOB;
    BEGIN
    APEX_APPLICATION.G_FLOW_ID :=245;
    IF NOT (wwv_flow_custom_auth_std.is_session_valid) then
    owa_util.status_line(404, 'Page Not Found',true);
    return;
    else
    SELECT MIME_TYPE, BLOB_CONTENT, name,DBMS_LOB.GETLENGTH(blob_content)
    INTO v_mime,lob_loc,v_file_name,v_length
    FROM spp_attachments
    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 if;
    end download_file; }
    Thank you,
    Mark

  • How is it posible to get the File name, size and type from a File out the H

    How is it posible to get the File name, size and type from a File out the HttpServletRequest. I want to upload a File from a client and save it on a server with the client name. I want to conrole before saving the name, type and size of the file.How is it posible to get the File name, size and type from a File out the HttpServletRequest.
    form JSP
    <form name="form" method="post" action="procesuploading.jsp" ENCTYPE="multipart/form-data">
    File: <input type="file" name="filename"/
    Path: <input type="text" readonly="" name="path" value="c:"/
    Saveas: <input type="text" name="saveas"/>
    <input name="submit" type="submit" value="Upload" />
    </form>
    proces JSP
    <%@ page language="java" %>
    <%@ page import="java.util.*" %>
    <%@ page import="FileUploadBean" %>
    <jsp:useBean id="TheBean" scope="page" class="FileUploadBean" />
    <%
    TheBean.doUpload(request);
    %>
    BEAN
    import java.io.*;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.ServletInputStream;
    public class FileUploadBean {
    public void doUpload(HttpServletRequest request) throws IOException
              String melding = "";
              String filename = request.getParameter("saveas");
              String path = request.getParameter("path");
              PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("test.java")));
              ServletInputStream in = request.getInputStream();
              int i = in.read();
              System.out.println("filename:"+filename);
              System.out.println("path:"+path);
              while (i != -1)
                   pw.print((char) i);
                   i = in.read();
              pw.close();
    }

    Thanks it works great.
    Here an excample from my code
    import org.apache.commons.fileupload.*;
    public class FileUploadBean extends Object implements java.io.Serializable{
    String foutmelding = "geen";
    String path;
    String filename;
    public boolean doUpload(HttpServletRequest request) throws IOException
         try
         // Create a new file upload handler
         FileUpload upload = new FileUpload();
         // Set upload parameters
         upload.setSizeMax(100000);
         upload.setSizeThreshold(100000000);
         upload.setRepositoryPath("/");
         // Parse the request
         List items = upload.parseRequest(request);
         // Process the uploaded fields
         Iterator iter = items.iterator();
         while (iter.hasNext())
         FileItem item = (FileItem) iter.next();
              if (item.isFormField())
                   String stringitem = item.getString();
         else
              String filename = "";
                   int temp = item.getName().lastIndexOf("\\");
                   filename = item.getName().substring(temp,item.getName().length());
                   File bestand = new File(path+filename);
                   if(item.getSize() > SizeMax && SizeMax != -1){foutmelding = "bestand is te groot.";return false;}
                   if(bestand.exists()){foutmelding ="bestand bestaat al";return false;}
                   FileOutputStream fOut = new FileOutputStream(bestand);     
                   BufferedOutputStream bOut = new BufferedOutputStream(fOut);
                   int bytesRead =0;
                   byte[] data = item.get();
                   bOut.write(data, 0 , data.length);     
                   bOut.close();
         catch(Exception e)
              System.out.println("er is een foutontstaan bij het opslaan de een bestand "+e);
              foutmelding = "Bestand opsturen is fout gegaan";
         return true;
         }

  • Automatically open file based on MIME type and file extension

    We have an app that is registered to handle custom MIME type and file extension. This works perfectly on IE and FireFox causing them to download the file to a temp folder and then launch our app associated with MIME type and file extension with command line to the downloaded file. On Safari however this does not work. It opens up a download window and shows that it has downloaded the file with no option to open it.

    hello, you can file a bug on bugzilla.mozilla.org if you want to include your plugin in the plugin finder service...
    [https://wiki.mozilla.org/PFS]

  • [svn] 1607: Set svn:mime-type and svn: eol-style on LICENSE and NOTICE files in the lib directory.

    Revision: 1607
    Author: [email protected]
    Date: 2008-05-07 17:02:39 -0700 (Wed, 07 May 2008)
    Log Message:
    Set svn:mime-type and svn:eol-style on LICENSE and NOTICE files in the lib directory.
    Modified Paths:
    flex/sdk/branches/3.0.x/lib/batik-NOTICE.txt
    flex/sdk/branches/3.0.x/lib/commons-discovery-LICENSE.txt
    flex/sdk/branches/3.0.x/lib/xalan-NOTICE.txt
    flex/sdk/branches/3.0.x/lib/xerces-LICENSE.txt
    Property Changed:
    flex/sdk/branches/3.0.x/lib/batik-LICENSE.txt
    flex/sdk/branches/3.0.x/lib/batik-NOTICE.txt
    flex/sdk/branches/3.0.x/lib/commons-collections-LICENSE.txt
    flex/sdk/branches/3.0.x/lib/commons-discovery-LICENSE.txt
    flex/sdk/branches/3.0.x/lib/commons-logging-LICENSE.txt
    flex/sdk/branches/3.0.x/lib/commons-logging-NOTICE.txt
    flex/sdk/branches/3.0.x/lib/mm-velocity-LICENSE.txt
    flex/sdk/branches/3.0.x/lib/mm-velocity-NOTICE.txt
    flex/sdk/branches/3.0.x/lib/xalan-LICENSE.txt
    flex/sdk/branches/3.0.x/lib/xalan-NOTICE.txt
    flex/sdk/branches/3.0.x/lib/xerces-LICENSE.txt

    Thanks for your attention.
    In the above logs, higher resolutions seems to be detected on both screens, hence my surprise :
    [ 391.631] (II) intel(0): Printing probed modes for output LVDS1
    [ 391.631] (II) intel(0): Modeline "1600x900"x60.0 110.00 1600 1664 1706 2010 900 903 906 912 -hsync -vsync (54.7 kHz eP)
    [ 391.897] (II) intel(0): Printing probed modes for output HDMI1
    [ 391.897] (II) intel(0): Modeline "1680x1050"x59.9 119.00 1680 1728 1760 1840 1050 1053 1059 1080 +hsync -vsync (64.7 kHz eP)
    If it can help here is also my current xrandr output (after having called it manually to use the preferred resolution of each screen)
    itanguy ~ $ xrandr
    Screen 0: minimum 320 x 200, current 1680 x 1050, maximum 8192 x 8192
    LVDS1 connected 1600x900+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
    1600x900 60.0*+ 40.0
    1024x768 60.0
    800x600 60.3 56.2
    640x480 59.9
    VGA1 disconnected (normal left inverted right x axis y axis)
    HDMI1 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 434mm x 270mm
    1680x1050 59.9*+
    1280x1024 75.0 60.0
    1152x864 75.0
    1024x768 75.1 60.0
    800x600 75.0 60.3
    640x480 75.0 60.0
    720x400 70.1
    DP1 disconnected (normal left inverted right x axis y axis)
    HDMI2 disconnected (normal left inverted right x axis y axis)
    HDMI3 disconnected (normal left inverted right x axis y axis)
    DP2 disconnected (normal left inverted right x axis y axis)
    DP3 disconnected (normal left inverted right x axis y axis)
    If needed, I may reboot and provide xrandr output after boot (it will be 1024x768), or could other logs help you ? Please ask...

  • Mime-types and schemas

    Hi
    after my last update yesterday I have got some problems with some mime-types. Directly after the update pacman said the following:
    Warning in file "/usr/share/applications/nautilus-folder-handler.desktop": usage of MIME type "x-directory/gnome-default-handler" is discouraged ("x-directory" is an old media type that should be replaced with a modern equivalent)
    Warning in file "/usr/share/applications/nautilus-folder-handler.desktop": usage of MIME type "x-directory/normal" is discouraged ("x-directory" is an old media type that should be replaced with a modern equivalent)
    Error in file "/usr/share/applications/oraclexe-readonlinehelp.desktop": "Application/database" is an invalid MIME type ("Application" is an unregistered media type)
    Error in file "/usr/share/applications/oraclexe-startdb.desktop": "Application/database" is an invalid MIME type ("Application" is an unregistered media type)
    Warning in file "/usr/share/applications/chromium-browser.desktop": usage of MIME type "x-directory/webdav" is discouraged ("x-directory" is an old media type that should be replaced with a modern equivalent)
    Warning in file "/usr/share/applications/chromium-browser.desktop": usage of MIME type "x-directory/webdav-prefer-directory" is discouraged ("x-directory" is an old media type that should be replaced with a modern equivalent)
    I also get a similar message when I try to install awn-extras from AUR altough it is installable (but not fully functional).
    (1/1) Installiere awn-extras-bzr [#####################] 100%
    I/O warning : failed to load external entity "/usr/share/gconf/schemas/awn-extras.schemas"
    »/usr/share/gconf/schemas/awn-extras.schemas« konnte nicht geöffnet werden: Datei oder Verzeichnis nicht gefunden
    It says, that the schema isnt found. Do you have any solutions?
    ~kiro

    .oO(Art)
    >When validating site, I'm getting the the following
    warning
    >-------------------------
    >Conflict between Mime Type and Document Type
    >
    >The document is being served with the text/html Mime Type
    which is not a
    >registered media type for the XHTML 1.1 Document Type.
    The recommended
    >media type for this document is: application/xhtml+xml
    >-------------------------
    >I work with ASP and I can't figure out why, really, it's
    doing this nor
    >can I figure out how to solve it.
    XHTML 1.1 documents should be delivered as
    application/xhtml+xml. This
    is not recommended, since IE doesn't support this MIME type.
    So switch
    back to XHTML 1.0 Strict, which can also be delivered as
    text/html.
    Micha

  • How to get uploaded file details in custom page

    Hi,
    I need to navigate to custom page after multiple file upload and display details of file uploaded in the custom page.
    Is there any variable which indicates the files uploaded that can be used in my custom page?
    Thanks in advance,
    dhijit

    Hi,
    According to your description, you want to get uploaded file details after uploading the files in a custom page.
    I suggest you create an event receiver in the custom page so that you can get file details when the files are added to the document library.
    Here is a code snippet for your reference:
           public override void ItemAdded(SPItemEventProperties properties)
               base.ItemAdded(properties);
               string fileURL = properties.ListItem.Web.Url + "/" + properties.ListItem.File.Url;
    More information about how to create an event receiver:
    http://bramnuyts.be/2011/04/01/add-an-event-receiver-to-a-specific-list-programmatically/
    Here is a similar thread about get uploaded files field:
    http://social.technet.microsoft.com/Forums/en-US/ad447c63-158c-4d92-8354-7d7f5b18e517/how-to-get-the-fileid-of-upload-files?forum=sharepointdevelopmentprevious
    Best regards,
    Zhengyu Guo
    Zhengyu Guo
    TechNet Community Support

  • Impossible Upload files with Filezilla FTP Client after upgrade win8 to win8.1

    Hi
    Things were working fine with win 8 but, after Upgrade to win 8.1 is not possible upload files with Filezilla  FTP Client.
    is there anyone facing same problem?
    thanks in advance for any answer to help me solve this issue 
    Regards 
    TC

    Hi,
    Please Change your transfer settings in site manager from either default or passive to active it to see what's going on.
    Also, check IE compatibility mode.
    In addition, I suggest you install all latest updates for Windows since these updates will improve and fix some known issues.
    Kate Li
    TechNet Community Support

  • Mime Types and site validation?

    When validating site, I'm getting the the following warning
    Conflict between Mime Type and Document Type
    The document is being served with the text/html Mime Type
    which is not a
    registered media type for the XHTML 1.1 Document Type. The
    recommended
    media type for this document is: application/xhtml+xml
    I work with ASP and I can't figure out why, really, it's
    doing this nor
    can I figure out how to solve it.
    I use: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    and everything validates fine except for this last thing.

    .oO(Art)
    >When validating site, I'm getting the the following
    warning
    >-------------------------
    >Conflict between Mime Type and Document Type
    >
    >The document is being served with the text/html Mime Type
    which is not a
    >registered media type for the XHTML 1.1 Document Type.
    The recommended
    >media type for this document is: application/xhtml+xml
    >-------------------------
    >I work with ASP and I can't figure out why, really, it's
    doing this nor
    >can I figure out how to solve it.
    XHTML 1.1 documents should be delivered as
    application/xhtml+xml. This
    is not recommended, since IE doesn't support this MIME type.
    So switch
    back to XHTML 1.0 Strict, which can also be delivered as
    text/html.
    Micha

  • Upload file of type Spreadsheet.ods  to internal table

    Hi Experts,
    can any body give me function module to upload file of type Spreadsheet.ods  into internal table
    Thanks in Advance
    Narendra

    Hi Renu,
    it is not supporting this function modules.
    we r using open office and its just like excel sheet.
    even function module ALSM_EXCEL_TO_INTERNAL_TABLE
    not supporting.
    Narendra

  • [CLOSED] Graphical file/mime type association editor?

    Is anyone aware of a general-purpose (i.e. not belonging necessarily to one of the major DEs) file/mime type association editor? I'd like to be able to change the default applications of a given file-type independently of the DE. In particular, I'd like to know how to set a default file manager.
    Last edited by nbtrap (2011-10-31 19:39:10)

    It doesn't look like there is a desktop-independent GUI for editing filetype associations. As far as I now understand, the concept itself it practically meaningless since DEs that conform to xdg standards have their own sets of associations. At any rate, the xdg-* tools are actually quite easy to work with. And I don't see any difference between mimeo and xdg-open. Thank you both for your help.

  • How can i upload files in servlets and also using jsp

    means that uploading files(.doc) or any files by using servlets and jsps

    yawmark wrote:
    saichand wrote:
    means that uploading files(.doc) or any files by using servlets and jsps
    [http://www.google.com/search?q=How+can+i+upload+files+in+servlets+and+also+using+jsp]
    ~Good topic titles are indeed brilliant search keywords. It's sad to see that it won't even come in the mind of the topicstarters to Google it before posting the topic.

  • Mime-type and/or extension of script file

    I would like to generate a script file dynamically on my web server and then have it downloaded to my users such that they can simply double-click the file and have it execute. I've gotten pretty close by using the ".command" extension, but it still requires a "chmod +x filename" after download in order to work properly. Is there another extension or a mime-type that I could use that would cause Mac OS X 10.4 and/or 10.5 to grant execute rights to the user that downloaded it? I'm not married to it being shell script if it can be done with AppleScript, Ruby, etc that would be great. It basically just has to be text file (non-binary format) so I can dynamically generate it on the server side.

    Hi Daniel,
    do you use EPG, mod_plsql or APEX Listener? Have you changed the connection mechanism after upgrading to 4.2.1?
    If you use the APEX Listener, which version do you use? Which browser and version do you use to upload the file? Does it reproduce with other browsers as well?
    Regards
    Patrick
    Member of the APEX development team
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • How to get uploaded file name and path in BefExportToDat event script

    I would like to get hold of the uploaded file name and full path in the event script "BefExportToDat", as I need to extract values from particular fields. However I have not yet found a way to do this.
    - The input variable "strFile" returns the .Dat file path in the Outbox, to which it is about to export the data. This is no use to me.
    - The API variable RES.PstrFilename is returning nothing
    I am using RES.PstrFilename in the "BefFileImport" event script in a different FDM application and it works fine, however I need to find a way to get this to work in the "BefExportToDat" event script.
    Please let me know how this might be achieved.

    I am looking through the API calls in FDM Workbench, but cannot see the table (tPOVPartitions) you mentioned listed. Is this the correct name? And do I just use the function listed in the object browser to run the query?
    Furthermore (going back to my initial thoughts of using strFile), it appears that although the variable contains the .Dat filename and path, the actual file is non-existent when "BefExportToDat" is executed:
    Error:
    Error: Export failed.
    Detail: File not found.
    This would make sense, but it does make the variable "strFile" a little pointless since one cannot make use of the file in this particular event script. Do you please have any thoughts on this?

  • When I try to click on a download link for a .pdf file Firefox does not recognize the MIME type and tries to download the file as "index.php"

    When visiting a site I frequent I tried to download a linked .pdf file. Previously I've used Firefox 7.0.1 to download the link with no problem. Using Firefox 8 however I the browser does not recognize the .pdf link's mime type. Instead of recognizing the download link as a .pdf file Firefox 8 tries to download it as "index.php". Firefox 8 does this with .doc files and .txt files as well. When I downgrade to 7.0.1 again the problem disappears.

    Hi hakmacpace,
    I'd try starting Firefox in [[Safe Mode]]. If you don't have the issue while all of your add-ons, extensions, and themes are disabled, you can try adding them back in one by one until you find the culprit. You should look at the [https://support.mozilla.org/en-US/kb/Troubleshooting-extensions-themes Extensions and Themes troubleshooting guide ] and the [[Troubleshooting plugins]] article as well.
    You could also try [https://support.mozilla.org/en-US/kb/Managing-profiles?s=create+a+new+profile&r=2&e=es&as=s#w_creating-a-profile Creating a new profile].
    Hopefully this helps!

Maybe you are looking for

  • How to convert a word file into PDF in command line ?

    Hi, I want to convert a word (excel, powerpoint, ...) into a PDF using a windows command line. The command : c:\> acrodist toto.ps is working file and the output is a PDF file (toto.pdf) But if i try with a MS office word file it is not working c:\>

  • My apple earphones melted in my car today.

    Today I went to my car and reached into the drivers side door compartment to get my apple earphones. I reached in to find that they had melted. I had the sunshade on my car windscreen and the windows partially down cos I drive a black car and wanted

  • Non-valuated GR..

    hi,       As i know the non-valuated GR is made when we use multiple account assignment or use the indicator given in PO and PR.... Is there any other scenario in which the non-valuated GR can be created??? Thanks Priyanka

  • How to manually restart a service

    systemuiserver hung up on me recently and after forcing it to quick in activity monitor, I could not figure out how to restart the service. I'm new to mac from windows, where I would just go to where the services are listen and click restart. I did t

  • Slideshow Viewer with music - Flex example code??

    Hello. I am not a Flex programmer at this time. I have only started looking at it because a client of mine wants a slideshow viewer that fades between images and plays music on her website. The site is done with simple PHP. Can someone point me in th