Identifying the correct MIME type for file uploads

How does Apex identify the MIME type of an uploaded file? I have a page that uploads a file and accesses it via APEX_APPLICATION_FILES. That works fine. The problem is that, for certain file types, the mime_types column is "application/octet-stream" instead of the correct file type. I think it's using the Content-Type from the client browser, though I'm not quite sure. Is there any way to override this server-side in Apex?
I'm running Apex with mod_plsql. Adding an AddType directive to Apache and adding the correct association to the mime.types file did not work.

Hi,
I also noticed this - it seems that Microsoft's 4 char extensions like .docx are not being recognized by application type so that either the web server or mod-plsql is defaulting to the "application/octet-stream" mime type which refers to a file with binary content - instead of the traditional "application/msword" mime type you would expect.
If you know, at the point of insert into your database table, both the mime type and file name, one workaround would be to check if the mime type is 'application/octet-stream' and the file's extension is ".docx" or other likely extensions and then treat it as mime type 'application/msword", etc.
Not really a solution but might be sufficient workaround depending on your situation.
Ted
Edited by: Ted Martin on Oct 25, 2012 7:27 PM

Similar Messages

  • What is the correct MIME type for an AD RMS protected PFILE?

    Hi,
     The context of why this question is asked is as follows: In an SAP Webdynpro application (the UI is displayed in a web browser). We intercept the file with SAP data that is being downloaded, encrypt it using AD RMS and then send the modified (encrypted)
    file back to be downloaded by the browser into the user's downloads folder.
     Because of this interception and modification of the text file being downloaded (.txt), which is now a .PTXT file (PFILE) there is a conflict in the MIME TYPE. 
    So could you let me know what the MIME type for a PFILE would be? Is there a standard MIME Type for all these PFILES? (.ptxt, .pfile etc..)? And is it by any chance "application/octet-stream"?

    Hi,
    I also noticed this - it seems that Microsoft's 4 char extensions like .docx are not being recognized by application type so that either the web server or mod-plsql is defaulting to the "application/octet-stream" mime type which refers to a file with binary content - instead of the traditional "application/msword" mime type you would expect.
    If you know, at the point of insert into your database table, both the mime type and file name, one workaround would be to check if the mime type is 'application/octet-stream' and the file's extension is ".docx" or other likely extensions and then treat it as mime type 'application/msword", etc.
    Not really a solution but might be sufficient workaround depending on your situation.
    Ted
    Edited by: Ted Martin on Oct 25, 2012 7:27 PM

  • Why do I still get giant gray 'X's instead of an audio player, even with the correct MIME type for my Ogg Vorbis file, whether coded in the audio tag or as a source?

    I uploaded Saturnalia.ogg to my site and used the audio tag to try to display it on my test page. I'd love to ditch the ultra-slow Flash players I currently use, but I don't want to leave most of my site's users wondering what the files sound like, where they are, and why are there giant gray Xs ruining my layout. The audio files work fine in Safari and Opera, and IE uses the correct fallback text. I've tried both coding the file into the audio tag and into source tags. I've set controls="controls" and tried both type="audio/ogg" and type="audio/vorbis". I've tried with and without autoplay.
    According to Mozilla, audio tags are supported, but I'm not seeing any of that support on my site.

    Where are you seeing that?
    Earlier:
    <audio src="dsh.ogg" controls="controls" type="audio/ogg">Your browser does not support the HTML5 audio tag.</audio>
    Now:
    [<object type="application/x-java-applet" width="580" height="15px" controls="controls">
    <param name="archive" value="cortado.jar" />
    <param name="code" value="com.fluendo.player.Cortado.class" />
    <param name="url" value="http://desolosubhumus.webs.com/dsh.ogg" />
    You need to install Java to play this file.
    </object>]<br />
    <audio src="dsh.ogg" type="audio/ogg">
    You need to install Java to play this file.
    </audio>
    *p tags removed for readability
    I know the audio tag should open before the object tag opens and close after the object tag closes, and that I shouldn't need duplicate fallback text, but it wouldn't show up that way. The way I have it set up now finally works on Firefox, IE (plays, not fallback text), Opera, Safari, and Chrome. I'm still trying to tweak the code to make it more standard (audio tags in the proper places), to clean it up so it's not such a huge chunk, and to see if I can get the applet to stay visible (which may not be possible, as the only way I've made it work is as a Cortado VIDEO instead of a purely audio file), and to make it stop autoplaying instead of playing when the user chooses play. Perhaps a Kate stream for track labels and a play button image set directly behind the applet when the play button actually is.

  • Any code available to get mime-type for file?

    Hi,
    at this link http://www.utoronto.ca/ian/books/html4ed/appb/mimetype.html you can find a huge listing of content-types for files. What I'd like to know is, if there's any code available for getting the right mime-type for a given file-extension. E.g given a filename "Document.doc" returns mime-type "application/msword".
    Thanks in advance,
    Tom

    U can use the isMimeType() method to compare various types.
    Eg. isMimeType("text/plain") or isMimeType("multipart/*") etc.

  • Incorrect MIME type for XML Data Connection POST requests

    It appears that Xcelsius 2008u2019s XML Data Connection logic does not specify the correct MIME type for the data it sends to the server in its POST request.  Using an HTTP debug proxy, I was able to see that Xcelsius sends XML data in the POST, but is setting a content-type of u201Cx-www-form-urlencodedu201D.  According to the W3C spec:
      http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1
    Data sent with a MIME type of u201Cxxu201D should be encoded as key?value pairs, like this:
      key1=val1&key2=val2&Submit=Submit
    So, what Xcelsius is doing is clearly incorrect.  Worse, if your server process is a Java servlet, you may find that the POSTed data will be gobbled up by the servlet container and you wonu2019t be able to read it using a getInputStream(), or getReader() call because itu2019s already been processed by a call to the getParameter() method.
    The correct mime type for POSTing an XML formatted request from Xcelsius should be "text/xml".
    Wayne

    Hi,
    The Error #2032 your getting is due to the Flash player security.
    To remove this this error you need one crossdomain Xml file in the root directory which actually provides a lot more control over who has access to your data from a SWF. The cross domain policy is attached as crossdomain.xml.
    In the XML file, it is used a wildcard (*). This allows a SWF located on any machine to access your data source. You can certainly use an IP address or domain name to restrict access rather to opening it up completely. I always start with the wildcard to make sure my dashboard works, then start restricting access as necessary.
    Here is a whitepaper with everything you need to know about Flash player security:
    http://www.adobe.com/devnet/flashplayer/articles/flash_player_9_security.pdf
    Please let me know if you need any more clarification.
    Regards,
    Sanjay

  • The MIME type for xslx file is different in Mozilla 13.0.1

    The MIME type for a xslx file is coming as "application/vnd.ms-excel.12" in Mozilla 13.0.1 instead of the "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" which comes in other browsers when using fileUpload.PostedFile.ContentType

    Firefox usually gets the MIME type from the MIME database registry key.
    * HKEY_CLASSES_ROOT\.xslx
    * HKEY_CLASSES_ROOT\MIME\Database\Content Type

  • How to set Mime Type for Static Files

    Hi All,
    I am working on Apex 3.2.1.00.10.
    When I am trying to upload (create) a ".js" file into Static Files under Shared Components of an application; it is saving as "*text/plain*" for Mime Type. But I need Mime type to be set as "*application/x-javascript*".
    Please help me to change the Mime type of .js file.
    Or is there any way to upload the file directly as "*application/x-javascript*" as its Mime Type.
    Thanks in advance.
    Umesh

    In IIS v4 which comes with the Windows NT4 option pack, you right click the web page you are working with, select properties, then go to the HTTP Headers tab. At the bottom there's a button labelled File Types in the MIME Map section.
    After you've clicked that, you can add the two mime types you need;
    Associated Extension MIME Type
    .jar application/x-java-jar-file
    .jnlp application/x-java-jnlp-file
    I'm assuming that it is the same in W2k/IIS5.

  • (261705413) Q RPCC-21 Missing text/xml MIME-type for WSDL files?

    Q<RPCC-21> Would it mess up the SOAP operations that clients do when using the
    WSDL in a dynamic client to put a text/xml mime type in the WSDL-providing jsp?
    A<RPCC-21>: It is a known issue that the MIME-type for WSDL files is not appropriately
    transmitted so some web browsers will not identify an appropriate helper application
    when they are viewed (for Netscape just press Ctrl-U to view the source). This,
    however, does not affect the dynamic client as evidenced by the example code seen
    in the code demonstration.
    Adam

    SR,
    You probably already have the answer by now, but I just came across the same problem and found the answer elsewhere.
    The trick is to have the JavaMail jar in your classpath BEFORE the JAF jar. Given the habit of my development environment to sort jars alphabetifally it had me stumped for a bit.
    Good luck
    Marc

  • Standard mime type for .acsm file

    What is the standard mime type that should be used for an .acsm file?
    Is it this? - application/vnd.adobe.adept+xml
    I can see few eBook sellers sharing this mime type: application/vnd.adobe.adept (without the +xml).  I can see in such cases few of the free reader apps availbale in android / iOS are not recognizing the file.
    Pl advice.
    Thanks, Sundar

    I believe from looking around on the web, just the following is used:
    application/xml
    Take care, Mike
    Message was edited by: MikeWenzloff

  • [svn] 609: Changed the svn:mime-type of the SDK's milestones.html file.

    Revision: 609
    Author: [email protected]
    Date: 2008-02-21 14:47:48 -0800 (Thu, 21 Feb 2008)
    Log Message:
    Changed the svn:mime-type of the SDK's milestones.html file.
    Property Changed:
    flex/sdk/milestones.html

    the web xml mime type setting are for static files served by the server...
    if you print a file directly to the output of the servlet, you must set the mime type, so DO write :
    response.setContentType( "application/vnd.ms-excel" );
    IE "works fine" because it also uses the file extension to decide the mime type... but in the absolute, it's a wrong behaviour

  • ALBPM 6.0 : The maximum size for file uploads has been exceeded.

    Hi,
    I use AquaLogic BPM Entreprise server to deploy my Process. When I try to publish a process on my server I get the following error:
    An unexpected error ocurred.
    The error's technical description is:
    "javax.servlet.jsp.JspException: null"
    Possible causes are:
    The maximum size for file uploads has been exceeded.
    If you are trying to publish an exported project you should publish it using the remote project option.
    If you are trying to upload the participant's photo you should choose a smaller one.
    An internal error has ocurred, please contact support attaching this page's source code.
    Has someone resolve it?
    Thank's.

    Hi,
    Sure you've figured this out by now, but when you get the "Maximum size for file uploads" error during publish consider:
    1. if your export project file is over 10mb, use "Remote Project" (instead of "Exported Project") as the publication source. That way when you select the remote project, you will point to ".fpr" directory of the project you are trying to publish.
    Most times your project is not on a network drive that the server has access to. If this is the case, upload the .exp file to the machine where the Process Administrator is running, then expand it in any directory (just unzip the file). Then, from the Process Administrator, use the option to publish a Remote Project by entering the path to the .fpr directory you just created when unzipping the project.
    2. Check to see if you have cataloged any jars and marked them as non-versionable. Most of the times the project size is big just because of the external jar files. So as a best practice, when you do a project export select the option "include only-versionable jars", that will get reduce the project size considerably (usually to Kb's). Of course you have to manually copy the Jar files to your Ext folder.
    hth,
    Dan

  • How do I get an SVG file to the same color profile as my illustrator file (U.S. Web Coated (SWOP) v2 and what would be the correct color profile for printing on a shirt?

    How do I get an SVG file to the same color profile as my illustrator file (U.S. Web Coated (SWOP) v2 and what would be the correct color profile for printing on a shirt?
    Thank you.

    dadanas wrote:
    Hi Simcah, I have a similar problem. Have you found out any solution?
    thanks, dan
    You need to ask the printing service provider. Dealing with color totally depends on the printing process involved and of course the machines used.

  • Setting the correct content type

    Hi,
    We store files in a database and the actual uploading and retrieving process works very well.
    However, when serving a request for a file I would like to set the content type the browser can read.
    An example: a httpservletRequest header "accept" comes back with */* - accepting all. Say the file requested is a xls spreadsheet. Since the accept header does not give me any information about the accepted content types, the following possibilities arise for a xls spreadsheet:
    - application/excel
    - application/vnd.ms-excel
    - application/x-excel
    - application/x-msexcel
    Same thing for power point files (.ppt) and others.
    Which of the listed content types do I set as the contentType for the HttpServletReponse so that the browser displays the information correctly?
    Whenever possible I would like to avoid the save dialog and display the file inline in the browser.
    Thanks for the help,
    -Rogier

    Here is the complete list of the right MIME types: http://www.w3schools.com/media/media_mimeref.asp
    You can retrieve it from filename by URLConnection#guessContentTypeFromName(), or add an extra field to the database which saves the MIME type.
    Checkout this FileServlet example for some insights: http://balusc.xs4all.nl/srv/dev-jep-fil.html

  • Error: JAR did not have the correct media type

    *** Error ***
    A problem occured during deploying application from http://127.0.0.1:1267/Video.jad
    Reason:
    JAR did not have the correct media type, it had application/x-java-archive
    E:\Documents and Settings\MatLab2.R\My Documents\NetBeansProjects\Video\nbproject\build-impl.xml:202: exec returned: 1 BUILD FAILED (total time: 3 seconds)I encountered this just once when I run the sample code from JavaFX here using a mobile emulator. This code is for adding a media player. After that one time, the output doesn't contain error messages anymore and the screen just goes blank.
    What does this error mean?
    I used:
    JDK / JRE 6 u 18
    Netbeans 6.8
    JavaFX 1.2 SDK
    KLite Codec Pack Mega 583

    Hi!
    I had the same problem as you did. I just found that the problem is that we only add the type JAD to the mime types, but we also have to add the JAR type.
    Just add the following line to the mime.types file and it will work:
    application/java-archive      jar

  • BI IP --- Planning function for File Upload

    Hai All,
    In BI IP , When I am trying to load the data (text file) by using Planning function for File Upload. I am getting an error message When I am clicking on Update .
    Error Message : Inconsistent input parameter (parameter: <unknown>, value <unknown>).
    In Text file I am using Tab Separation for each value
    Anyone help me out.
    Thanks,
    Bhima

    Hi Bhima
    Try one of these; it should work:
    1. If you are on SP 14 you would need to upgrade to SP 15. It would work fine
    2. If not, then -
         a] apply note 1070655 - Termination msg CL_RSPLFR_CONTROLLER =>GET_READ_WRITE_PROVIDS
         b] Apply Correction Instruction 566059 [i.e: in Object - CL_RSPLFR_CONTROLLER GET_READ_WRITE_PROVIDS,
    delete the block: l_r_alvl = cl_rspls_alvl=>factory( i_aggrlevel = p_infoprov ).
    and insert block - l_r_alvl = cl_rspls_alvl=>factory( i_aggrlevel = i_infoprov ).
    Goodluck
    Srikanth

Maybe you are looking for

  • Problem in calling a WS with complex type

    Hi all... I have to invoke a WS that has as input type a complex type defined in the wsdl... <complexType name="LoginInfo"> - <sequence>   <element name="appCode" nillable="true" type="string" />   <element name="login" nillable="true" type="string"

  • Remote for Keynote?

    Can a wireless keyboard be used for a remote in Keynote?

  • Validation of select-option in module pool

    Hi experts, I want to make a check according to a field on my dynpro 100. The dynpro has a subscreen area and there is a select-option which I want to check (so_matnr). According to the check I want to update my table control on the same dnypro. How

  • Powershell Script Error, its saying The term is not recognized as the name of cmdlet

    Hi, When i am running following script into powershell, getting this error. i was not able to find out what could be the cause?Please help me out. Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue functionCreate-SPFoldersBulk

  • New to everything

    ive had a pc all my life, i just found a powermac g5 on craigslist for dirt cheap and i have been meaning to make the switch for sometime now. i know hardly anything about anything apple so i turned here for help. just go over the basics and how, and