How get Mime Types of File/image

I would like to get the MIME type all image/files inside a
folder

http://techfeed.net/blog/index.cfm/2007/3/16/Discover-MIME-type-in-ColdFusion
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/

Similar Messages

  • 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.

  • Get MIME type of file returns application/octet-stream for all but txt

    Eclipse 3.3.1.1, JRE 1.6.0_03, Tomcat 6.0, webwork 2.2.4
    I've created a test upload/view file page. I can successfully upload and return the file to view. However, the content type is always application/octet-stream except for txt.
    String contentType = new MimetypesFileTypeMap().getContentType(filename);
    System.out.println("contenttype for " + filename + ": "+contentType);I created mime.types in my META-INF for tomcat and populated it, but it doesn't change anything. Uploading an mp3 should return the audio/mpeg3 I have in mime.types:
    audio/mpeg3                         mp3
    I verified that it is in /wtpwebapps/MyApp/META-INF/
    My web.xml even has it:
        <mime-mapping>
            <extension>mp3</extension>
            <mime-type>audio/mpeg3</mime-type>
        </mime-mapping>Am I missing something?

    Darn it. The form gobbled up my mimeTypes.rdf code. Here it is again with the GT and LT symbols replaced with '+':
    +RDF:li RDF:resource="urn:mimetype:application/pdf2"/+
    +RDF:Description RDF:about="urn:mimetype:application/pdf2"
    NC:fileExtensions="pdf"
    NC:description="TonyTest PDF document"
    NC:value="application/pdf2"
    NC:editable="true"+
    +NC:handlerProp RDF:resource="urn:mimetype:handler:application/pdf2"/+
    +/RDF:Description+
    +RDF:Description RDF:about="urn:mimetype:handler:application/pdf2"
    NC:alwaysAsk="true"
    NC:saveToDisk="false"
    NC:useSystemDefault="false"
    NC:handleInternal="false"+
    +NC:externalApplication RDF:resource="urn:mimetype:externalApplication:application/pdf2"/+
    +/RDF:Description+
    +RDF:Description RDF:about="urn:mimetype:externalApplication:application/pdf2"
    NC:path="/usr/bin/acroread"
    NC:prettyName="acroread" /+

  • 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

  • Getting all types of files with the help of get_file_name function

    hi all,
    i am using Forms [32 Bit] Version 6.0.8.24.1 (Production).
    i have used get_file_name function to the file name of all type of files
    but i am able to get only the folders when i tried like below
    :FILE_NAME := GET_FILE_NAME(NULL,NULL,NULL,'Choose a Directory',OPEN_FILE,FALSE);my requirement to get all types of files on the window(user will selects whichever way he wants)
    Can i acheive it through get_file_name or i have to go for any alternative to get the file list, so that user can select by browsing the folders.
    Please help.
    Thanks..

    hi,
    in my code the select file was set to false(so showing only the directories) now i have set it to 'true'. its showing the files now.
    with the help of my above shown code i can get the full path of the file.
    is there any way to get only the file name?(other than the last occurance of '/' logic or that is only the way?)
    Please help.
    Thanks..

  • 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]

  • When I try to open images I am getting this message: "The file "image.jpg" couldn't be opened because you don't have permission to view it." "Which I've tried - but it's not responding, plus its with all images now. Can anyone help?

    When I try to open images I am getting this message: "The file “image.jpg” couldn’t be opened because you don’t have permission to view it." "Which I've tried - but it's not responding, plus its with all images now. Can anyone help?

    Back up all data.
    Triple-click anywhere in the line below on this page to select it:
    ~/Library/Containers/com.apple.iBooksX
    Right-click or control-click the line and select
    Services ▹ Reveal in Finder (or just Reveal)
    from the contextual menu.* A folder should open with an item selected. Quit the application if it's running. Move the selected item to the Trash. Relaunch the application and test.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination  command-C. In the Finder, select
    Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.

  • How get transparent index for indexed image?

    Hello,
    In my fileformat plugin on writing I can't get transparent
    color for indexed image. For RGB
    image I got transparent data from alfa channel in data of FormatRecord.
    The FormatRecord structure has value
    transparentIndex (for GIF), but it always =0
    (even, if in the image transparent index=12, for example).
    How can I get transparent index? Or, if it possible, how get transparent
    data for indexed image in alfa channel?

    Hello,
    In my fileformat plugin on writing I can't get transparent
    color for indexed image. For RGB
    image I got transparent data from alfa channel in data of FormatRecord.
    The FormatRecord structure has value
    transparentIndex (for GIF), but it always =0
    (even, if in the image transparent index=12, for example).
    How can I get transparent index? Or, if it possible, how get transparent
    data for indexed image in alfa channel?

  • Need to get the MIME type of Files

    hi
    I have a table which contains Partno and the images name i.e PRODUCT_AWG_20070416 and the data would be like that :-
    partno img_name
    PX1 px1.jpeg
    PX2 px2.jpeg
    PX3 px3.jpeg
    Now one by one i am Inserting those files into my table (img_temp -BLOB Column) which are exists in directory & the map file. but i also need to insert the MIME type of the inserted file. can you please provide me the way to generate MIME type on the basis of file type like (JPG,GIF,TXT etc).
    the procedure i am using is as follows :
    hi
    I have a TABLE which contains Partno AND THE IMAGES NAME i.e PRODUCT_AWG_20070416 AND THE DATA would be LIKE that :-
    partno img_name
    PX1 px1.jpeg
    PX2 px2.jpeg
    PX3 px3.jpeg
    Now one BY one i am INSERTING those files INTO my TABLE (img_temp -BLOB COLUMN) which are EXISTS IN DIRECTORY & THE map FILE. but i also need TO INSERT THE MIME TYPE OF THE inserted FILE. can you please provide me THE way TO generate MIME TYPE ON THE basis OF FILE TYPE LIKE (JPG,GIF,TXT etc).
    the reason of this requirement is, we need to use that table in APEX 2.2 fromwhere i can download the inserted file and to download the file we need to get correct MIME_TYPE of that file.
    Please Suggest me the way.
    Thanks.
    The Procedure which i am using is as follows :
    CREATE OR REPLACE PROCEDURE img_uploader IS
    CURSOR Cur_img IS SELECT part_no,image_file FROM PRODUCT_AWG_20070416
                             WHERE Transaction_id =1 ;
    l_bfile BFILE;
    l_blob BLOB;
    BEGIN
    FOR Cur_img_val IN Cur_img LOOP
    l_bfile := BFILENAME('SOLVS_PRODUCT_IMG', Cur_img_val.image_file);
    INSERT INTO img_temp (part_no,MIME_type,file_name, img)
    VALUES (Cur_img_val.Part_no,NULL, Cur_img_val.image_file,EMPTY_BLOB())
    RETURN img INTO l_blob;
    DBMS_LOB.fileopen(l_bfile, Dbms_Lob.File_Readonly);
    DBMS_LOB.loadfromfile(l_blob, l_bfile, DBMS_LOB.getlength(l_bfile));
    DBMS_LOB.fileclose(l_bfile);
    END LOOP ;
    COMMIT;
    END;

    Hello,
    Perhaps this can help:
    http://help.sap.com/saphelp_nw04/helpdata/en/ad/ebe5cc1d75aa43a2871717d76f475d/content.htm
    If you want to know the table name, turn on tracing (ST05) when accessing the MIME types.
    regards
    Rick Bakker
    Hanabi Technology

  • How to get MIME type of BLOB column.

    Hi,
    I have created OS directory folder(C:\Audio) in my c drive and having list of audio files in different format, Also I have created one table to store the audio files with Blob column.
    So, i need to know the MIME type of the BLOB column during the run time.

    Saroj Nayak wrote:
    I have created OS directory folder(C:\Audio) in my c drive and having list of audio files in different format, Also I have created one table to store the audio files with Blob column.
    So, i need to know the MIME type of the BLOB column during the run As recommended in the About BLOB Support in Forms and Reports documentation, use additional columns to store file metadata like the MIME type.

  • Trying to Access SharePoint 2013 Rest Api in HTML page but getting Mime Type Exception with Status Success

    I am trying to invoke the SharePoint Rest Api using HTML page. I have included the Access Control Allow Origin to the web.config file. I am getting Readty State 4 and
    Status Success but still I am getting the below error.
    Refused to execute script from 'http://<server>/_api//web/lists?callback=jQuery172045857910416089_1430217181282&_=1430217363882' because its MIME
    type ('application/atom+xml') is not executable, and strict MIME type checking is enabled.
        <script>
            $(document).ready(function () {
                $("#KMPDiscussions").click(function () {
                    //$.support.cors = true;
                    $.ajax({
                        url: "http://<server>/_api//web/lists",
                        dataType: "jsonp",
                        type: "GET",
                        method: "GET",
                        contentType: "application/javascript",
                        headers: {
                            "content-type":
    "application/json;odata=verbose",
                            "accept": "application/json;odata=verbose",
                        success: function onSuccess(data) {
                            alert("Inside Alert");
                        error: function onError(data){
                            alert("Error: "
    + data);
        </script>
    It always hits the error on callback.
    Is there any other way that I can invoke SharePoint Rest Api from a Cross Domain. Please Help.

    Hi Chris,
    Thanks for the reply,Here iam using different files to be uploaded in library.
    please find the below snapshot of json response and ULS logs.
    12/22/2013 18:31:15.02 w3wp.exe (0x3338) 0x401C SharePoint Foundation Files 
    abq2i High Could not get DocumentContent row: 0x80004005. 79f7629c-4694-c026-
    3349-2049178ee919
    12/22/2013 18:31:15.02 w3wp.exe (0x3338) 0x401C SharePoint Foundation Files 
    aiv4w Medium Spent 0 ms to bind -1 byte file stream 79f7629c-4694-c026-3349-
    2049178ee919 
    12/22/2013 18:31:15.02 w3wp.exe (0x3338) 0x401C SharePoint Foundation Files 
    aise3 Medium Failure when fetching document. 0x80070012 79f7629c-4694-c026-
    3349-2049178ee919
    12/22/2013 18:31:15.39 w3wp.exe (0x3338) 0x0D4C SharePoint Foundation 
    Database ab1a9 High Failed to get document content data.
    System.ComponentModel.Win32Exception (0x80004005): Cannot complete this function     at
    Microsoft.SharePoint.SPSqlClient.GetDocumentContentRow(Int32 rowOrd, Object
    ospFileStmMgr, SPDocumentBindRequest& dbreq, SPDocumentBindResults& dbres) 
    79f7629c-76ab-c026-3349-2c9132b13e9a
    12/22/2013 18:31:15.39 w3wp.exe (0x3338) 0x4184 SharePoint Foundation 
    Database ab1a9 High Failed to get document content data.
    System.ComponentModel.Win32Exception (0x80004005): Cannot complete this function     at
    Microsoft.SharePoint.SPSqlClient.GetDocumentContentRow(Int32 rowOrd, Object
    ospFileStmMgr, SPDocumentBindRequest& dbreq, SPDocumentBindResults& dbres) 
    79f7629c-76ab-c026-3349-281167b6cd09
    Thanks again,
    Naresh.

  • How load different types of file in SSIS

    could you please suggest how can we load different types of file in SSIS. The file metadata is not defined . So the SSIS
    package will read the files palced in a defined shared location or folder where based on the column value will determine the datatype on runtime and load the data.

    Hi SubhadipRoy,
    SSIS doesn’t support dynamic data access provider or metadata. That means that we need to use different source adapters for flat files (.csv and .txt) and Excel files. So, in the Control Flow, you can use three Foreach Loop Container: one to loop through
    .txt files, one to loop through .csv files, and the last one to loop through Excel files. In each Foreach Loop Container, you use a Data Flow Task to extract data from the corresponding source files. 
    If the source files have different structures, you need to use Script Component in the Data Flow Task to parse the first row of the source files and create destination table dynamically. Here are two script examples for your reference:
    http://www.citagus.com/citagus/blog/importing-from-flat-file-with-dynamic-columns/ 
    http://stackoverflow.com/questions/21672064/ssis-dynamic-column-mapping-in-excel-source-and-destination-sql-server-table 
    Regards,
    Mike Yin
    TechNet Community Support

  • How get a correct CSV file

    Hi,
    I've this table:
    CREATE TABLE TAB_BW (
    COD VARCHAR2 (2),
    COD_ID VARCHAR2 (20),
    DESCRIPTION VARCHAR2 (64),
    AREA NUMBER);
    with these data:
    INSERT INTO TAB_BW ( COD, COD_ID, DESCRIPTION, AREA ) VALUES (
    '00', '000099', 'MY HOME', 21.654);
    INSERT INTO TAB_BW ( COD, COD_ID, DESCRIPTION, AREA ) VALUES (
    '01', '001234', 'MY HOME, MY DOG', 2111.3232);
    INSERT INTO TAB_BW ( COD, COD_ID, DESCRIPTION, AREA ) VALUES (
    '11', '033333', 'OK, NO', 1222.22);
    INSERT INTO TAB_BW ( COD, COD_ID, DESCRIPTION, AREA ) VALUES (
    '03', '111111', 'NOW', 12);
    INSERT INTO TAB_BW ( COD, COD_ID, DESCRIPTION, AREA ) VALUES (
    '05', '000001', 'GOOD BYE', 1234567.34234);
    Now I'd like to create a CSV file with these data
    I created this pl/sql stored procedure:
    CREATE OR REPLACE procedure BW is
    file_a sys.utl_file.file_type;
         file_l sys.utl_file.file_type;
    DATA_ELAB varchar2(50);
    MSG varchar2(200);
    directory varchar2(50) := 'C:\EXTRACT';
    file_name varchar2(50) := 'BW';
    VAR_COD VARCHAR2(66);
    VAR_COD_ID VARCHAR2(20);
    VAR_DESCRIPTION VARCHAR2(64);
    VAR_AREA VARCHAR2(64);
    CURSOR CUR_IMM IS
    SELECT COD,
    COD_ID,
    DESCRIPTION,
    AREA
    FROM TAB_BW;
    PROCEDURE GET_DATA_DAY IS
    begin
         SELECT to_char(SYSDATE,'Day dd Month yyyy * hh24:mi:ss')
    INTO DATA_ELAB
    FROM DUAL;
    end GET_DATA_DAY;
    PROCEDURE OPEN_FILE IS
    BEGIN
    file_a :=
    sys.utl_file.fopen(directory,file_name||'_'||TO_CHAR(SYSDATE,'DD_MM_YYYY')||'.
    csv','w');
    END OPEN_FILE;
    PROCEDURE CLOSE_FILE IS
    BEGIN
    sys.utl_file.fclose(file_a);
    END CLOSE_FILE;
    PROCEDURE NOT_FOUND IS
    BEGIN
    sys.utl_file.put_line(file_l,('DATA NOT FOUND'));
    END NOT_FOUND;
    PROCEDURE WRITE_DATA IS
    BEGIN
    sys.utl_file.put_line(file_a,VAR_COD||','||VAR_COD_ID||','||VAR_DESCRIPTION||'
    ,'||VAR_AREA);
    END WRITE_DATA;
    BEGIN
    OPEN_FILE;
    GET_DATA_DAY;
    OPEN CUR_IMM;
    IF (CUR_IMM%NOTFOUND)
    THEN
    NOT_FOUND;
    ELSE
    LOOP
    FETCH CUR_IMM INTO VAR_COD,
    VAR_COD_ID,
    VAR_DESCRIPTION,
    VAR_AREA;
    EXIT WHEN (CUR_IMM%NOTFOUND);
    WRITE_DATA;
    END LOOP;
    END IF;
    CLOSE CUR_IMM;
    GET_DATA_DAY;
    CLOSE_FILE;
    END BW;
    but when I open the file BW.csv
    I get these output:
    COD......COD_ID...........DESCRIPTION...........AREA
    00.......000099...........MY HOME...............21.654
    01.......001234...........MY HOME...............MY DOG...........2111.3232
    11.......033333...........OK....................NO................1222.22
    03.......111111...........NOW....................12
    05.......000001...........GOOD BYE...............1234567.34234
    I'd like to get this output when I open the file BW.csv:
    COD......COD_ID...........DESCRIPTION...........AREA
    00.......000099...........MY HOME...............21.654
    01.......001234...........MY HOME, MY DOG.......2,111.3232
    11.......033333...........OK, NO................1,222.22
    03.......111111...........NOW....................12
    05.......000001...........GOOD BYE...............1,234,567.34234
    How Can I modify my procedure to get this output?
    Thanks in advance!

    MY HOME and MY DOG
    OK and NO
    are in separated columns
    I'd like to have it in same columnsEnclose the strings in double quotes
    Something like
    00.......000099..........."MY HOME"...............21.654Two more thing I just noticed:
    - Some of your rows seems to have 5 columns instead of 4
    - Excel is going to convert your Id to Numbers; 000 will be displayed as 99
    By the way your format is just a fixed-length format but not a CSV-format.
    CSV (comma separated values) would be something like
    "COD";"COD_ID";"DESCRIPTION";"AREA"
    "00";"000099";"MY HOME",21.654

  • IE Aborting Image Download with src attribute when over SSL and getting Content-Type header value image/jpg

    Images are not downloaded at all and page looks broken.
    The same page works fine over HTTP but shows the problem over HTTPS. Works fine in firefox and chrome.
    Checked and found the problem in IE 9, 10, 11
    Is it some bug in IE, I have searched the forums and searched internet. Got following but are not relevant to this case.
    Resetting src of the img (Ruled out, not doing any reset)
    Do not save encrypted pages to disk  is checked in advanced security options (Ruled out, unchecked)
    Using TLS 1.2 with SSL 2.0 (Ruled out, SSL 2.0 unchecked)
    Cache-preventing headers: Cache-Control header with the tokens no-cache, no-store (Ruled out, no such headers)
    Restarts due to parser reset owing XML Namespace declaration, Meta tags etc. (Ruled out, image tags are afterwards)
    Thanks in advance for help!

    I probably encountered the same problem.
    What happens when you disable the 'Use TLS 1.0' checkbox in Internet Options, Advanced, Security, 'Use TLS 1.0'?
    The only enabled option I have in IE is 'Use SSL 3.0'.
    Source:
    http://social.msdn.microsoft.com/Forums/ie/en-US/88a58e78-ebb4-469d-a361-0d3762a4cf80/ie10-reports-aborted-js-and-css-downloads-randomly?forum=iewebdevelopment

  • Free download from Epson downloads but wont open. Get wrong type of file or damaged file

    all I'm trying to do is find out how to open my free lightroom download

    Since you have what seems to be a valid serial number, I suggest that you download the trial version of Lightroom from this website:
    Adobe - Lightroom : For Windows : Adobe Photoshop Lightroom 5.7
    the trial version is the full version after you enter the serial number. After installation a screen will appear indicating that you are using the trial. On that screen there is an option to indicate that you have a serial number. Choose that option and provisions will be provided for you to enter the serial number that you have.

Maybe you are looking for

  • [svn] 1011: Change for supporting newer version of the concurrent library.

    Revision: 1011 Author: [email protected] Date: 2008-03-28 16:42:52 -0700 (Fri, 28 Mar 2008) Log Message: Change for supporting newer version of the concurrent library. When you remove, you need to provide the return value from the schedule method, no

  • AWR   SQL ordered by Cluster Wait Time

    I am beginner in Oracle Performance issue, I am working on sql query which appear on the top of queries list in the section SQL ordered by Cluster Wait Time have any one an explanation for this ? Thanks, Edited by: BIJGA on 19 sept. 2011 09:44

  • Feature 'nested external environment calls' not implemented

    Hi. I've created a .Net 3.5 DLL which is called by a stored procedure using CLR in a trigger. Inside one of the functions I've got an update-statement against the same table as the trigger which calls the CLR code. That update results in a SAExeption

  • Transport Error when including Transformations with Formulas

    I am attempting to transport a transformation that includes formulas.  I am getting an ASSERTION_FAILED short dump and my transport stops with an Error Code = 12.  Transformations without formulas or with routines seem to go ok. Here is a piece of th

  • Problem loading image from HTTPS

    I am having trouble loading an image in Java client , the image is coming from a secure server. My code looks as follows Image image = null; try // just substituting my image with the secure image I found on sun site URL url = new URL("https://www.su