Recognizing mime uploaded file type

Hi
I'm trying to restrict the mime type of an uploaded file to .PDF only. I can have some validation by using FileItem.getContentType() method from Apache commons' fileupload framework or by using FileDataSource.getContentType() method from COS framework, but both of these methods simply match the extension of uploaded file with MIME mappings of the server. If a user takes a .doc file and saves it as .pdf, i still get content type application/pdf for that file. Is it possible to check for these scenarios somehow?

You could give DROID (Digital Record Object Identification) a go:
http://droid.sourceforge.net/wiki/index.php/Introduction

Similar Messages

  • Gnome MIME and file type associations

    Hi
    I'm sure this must be simple enough, but can't seem to find it.  I want to associate plain text files with an .sla extension with Scribus, but the only way I know how to do this would associate all plain text files with scribus.
    Do I need to make a MIME type for Scribus .sla files (and if so, how?) or can Gnome be made to associate by extension as well?
    Thanks.
    Fishonadish

    I needed a gnome application for it too, i'll make a PKGBUILD for it .
    Edit: It's in AUR now
    Last edited by jordz (2007-03-21 22:24:28)

  • How to restrict uploading files by mime type?

    Hi,
    I have been searching the forum (and Google) looking for tips on how to ensure users can only upload files of specific formats (Word, PDF, etc) for specific document types as defined within the application (e.g. Curriculum Vitae (Word), Copy of Transcripts (PDF)).
    While I have used this research to start work on a server-side solution, I would like to know if there is an apex-friendly way to "validate" a file-browse item based on mime-type.
    Has anyone else had to address this?
    Ted

    Hi,
    I would like to know if there is an apex-friendly way to "validate" a file-browse item based on mime-typeHow about, you create a check constraint on your MIMETYPE column. something similar to this:
    alter table "MY_TABLE" add constraint
    "MY_TABLE_CON" check ( "MIMETYPE" = 'application/pdf' or "MIMETYPE" = ......)Or you can use this plugin, provided using browsers supporting HTML 5:
    http://www.theapexfreelancer.com/apex/f?p=APEXFREELANCER:FILE_UPLOAD:0
    For friendly,
    Please check error handling :
    http://www.inside-oracle-apex.com/apex-4-1-error-handling-improvements-part-1/
    Best Regards,
    Fateh

  • 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

  • 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 to check the type of uploaded file

    Hi, experts,
    how can I check the type of the uploaded file? I am dealing with exception handling now: when user uploads a type of file which is not allowed, then error msg shows up. So first I have to retrieve the type of the uploaded file.
    Best regards,
    Fan

    Best approach would be to control the file upload program. Here in force user to chose only the kind of file supported.
    If you are using WD4A & fileupload UI element, then after user select a file to upload, before processing the file you can check the file name and get its MIME TYPE as shown below.
    example
    data type file string.
    data dot_offset type i.
    data extension type mimetypes-extension.
    data mimetype type mimetypes-type.
    file = 'Image.jpg'.
    " Find out file name extension
    find first occurrence of regex '\.[^\.]+$' in file match offset dot_offset.
    add 1 to dot_offset.
    extension = file+dot_offset.
    " Get mime type
    call function 'SDOK_MIMETYPE_GET'
      exporting
        extension = extension
    importing
        mimetype  = mimetype.
    later using if/else or CASE statement define your logic.
    Greetings
    Prashant
    P.S. Points Welcome

  • How to change file type of iMovie in order to upload it to Youtube?

    When I was trying to upload a video to YouTube, it told me the file type is not supported. All of the articles I could find on Google were for the old version of iMovie. Any help would be greatly appreciated. Thanks! 

    Hey w_squid_98,
    Thanks for the question. The following resource outlines how you can share to various services with the latest version of iMovie:
    iMovie Help: Share online
    http://help.apple.com/imovie/mac/10.0/#move0470816c
    Thanks,
    Matt M.

  • Setting File type in Upload UI Element

    I want to set the file type as *.doc when the Browse option opens up in the Upload button.
    Is this achievable.

    Hi Soumya,
    Just as the upper 2 experts said,  so far we cann't achieve this in the existing edition of WD..This is not like in traditional ABAP, which we can use such as "Filter" in Dictionary-browser to restrict the file type .
    If we want to use only certain file type in WD, as far as i know, we should only using Coding to handle it..
    Best wishes.

  • Can not select a PDF file in the file uploader window after clicking the Browse... button for a file type input element.

    After upgrading to 5 (this worked in 4) I can not select a PDF file in the File Upload dialog that appears when I click the Browse button next to an HTML file type input element. The specific HTML element source code has the attribute: ACCEPT="image/*". I can select image files such as jpg, png, tiff, etc. But not PDF. This worked great in Furefox 4 and works in the latest version of Safari.
    The HTML code for the form element is:
    INPUT TYPE="file" NAME="file_1" ACCEPT="image/*" SIZE=35
    The File Upload dialog lists all files with PDF extension as dimmed and not selectable in Firefox 5.
    Can you help?

    Hi Purush
    Unfortunately we couldn't solve the problem. Our IT specialist checked it with SAP directly. SAP doesn't support the SAP KW solution anymore. Therefore we checked-in the document in ".doc"-Format.

  • Photo will not upload my pictures from the same camera that always worked in IPhoto.  Says "could not be imported (may be unrecognized file type or files may not contain valid data).  So how do I do it?

    Photo will not upload new photos from same camera that always worked in IPhoto.  Says "could not be uploaded )may be unrecognized file type or files may not contain valid data).  Help!

    Try image capture or a card reader - after the photos are safely on your Mac then use the camera's format command to reformat the memory card
    LN

  • How do one can upload a file (a PDF, doc etc) while filling a web form through chrome or safari? It is possible to upload a photo from the camera role, but other file types can not be uploaded.

    How do one can upload a file (a PDF, doc etc) while filling a web form through chrome or safari? It is possible to upload a photo from the camera role, but other file types can not be uploaded.

    For a variety of reasons, mostly related to security, the iOS operating system limits what can be done with respect to file uploading and downloading. But whenever you encounter a limitation like this always think, "There must be an app for this."
    Check the apps James Ward suggests.

  • How to upload any file type to R/3

    Please explain step by step how to upload any file type to R/3
    Thanks in advance

    Hi
    There are many ways of uploading any file type to R3, provided it depends on how do you want to store it.
    In general there are two easy ways, one is using the upload UI element, you can specify a path in the server and have configured it for all files and store the file directly in the file directory of the server.
    Secondly, you need to do some work on the sap side, like creating a simple rfc, which will take up the file content as a 'binary' (raw) data type and store in the database with the relevant parameters. you rfc will take / get the update from the webdynpro UI element ( you need to do create a model ..context / binding..etc ). The whole file will be stored in binary form.
    Hope this gives you some picture of how to go about on it.
    if you have any specific questions do let us know
    thanks

  • When I try to save an email attached file, the file name is automatically convertied to "attachment.ashx" although the correct file type is recognized. How do I retain the original file name?

    This problem occurred after the most recent update to firefox 8.0.
    After right clicking on the attached file, I click on save link as.
    The correct file type is recognized. However the file name is converted to "attachment.ashx".
    When I rename the file, it downloads properly and is opened by the appropriate program.
    However, I should not have to rename each downloaded file.
    In particular, this is happening with Word files and with Scientific Notebook (.tex) files.

    Cor-el, thank you for your advice. I was able to navigate to my Profile Folder and I deleted the mimeTypes.rdf file. I then closed Firefox and restarted it. The problem was still there, and I found that the mimeTypes.rdf file had been re-created.
    I tried your second suggestion, but the files you mentioned were not present so there was nothing to reset.
    Any other suggestions?

  • LiveType .ipr won't import into FCP - File type not recognized

    LiveType file is greyed out when trying to import into FCP as a Standard File type. If we change Standard File to All Files we get an error stating, "File Error: 1 file recognized, 0 access denied, 1 unknown."
    The project and media are on an external FWHD, originally edited on a G5, moved to the G4 FWHD with Media Manager.
    We've trashed FCP preference files, repaired permissions, checked ownership of files on the FWHD, created new LT files on the internal drive to no avail.
    Is it time for a reinstall of FCP Suite?
    G4 Tower 1.42 Ghz Mac OS X (10.4.7)
    G4 PowerBook 667 Mac OS X (10.3.7)
    G4 PowerBook 1.67 Mac OS X (10.4.7)
    G5 2.5Ghz Mac OS X (10.4.7)
    iMac G5 1.8Ghz   Mac OS X (10.4.7)  

    The project and media are on an external FWHD, originally edited on a G5, moved to the G4 FWHD with Media Manager. We've trashed FCP preference files, repaired permissions, checked ownership of files on the FWHD, created new LT files on the internal drive to no avail.< </div>
    This is usually two things: In compatible versions of FCP or a missing element that allows the .ipr files to be imported. I have forgotten what the enabler is but it's obviously working on your G5 or you wouldn't be asking the question. If you create a LT file on your G4, can you import it into FCP on the G$?
    (You can search the forum for similar problems, it comes up about twice a month.)
    That leaves the problem of incompatible copies of FCP. You have not provided that information. FCP is not backwards compatible.
    bogiesan

  • 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

Maybe you are looking for

  • Inspection type 01 - inspection lot creation based on vendor batch number

    Hi Guys, this topic has been discussed several times here, but I was not able to find a suitable answer for my question. I am facing the folowing requirement: I have activated inspection type 01 for a raw material. I am receiving a firs goods receipt

  • White screen of death STILL!?!?

    Hi i still have the white screen of death, i toke apart my ipod (screen, and the main screen) i bot a new glass screen cover and another screen witch is the main touch screen behind the glass1. so i put the news 1s on and i still have the white scree

  • Table name and field required for Project name

    Hi Guys I need to print Transfer order print out Which Table and field I need to take to print Project number (Original format) BSA01.000045.00002

  • Apple product printer for mac os system 7.6.1

    I misstated my question. I wish to know what apple product printer will work with a mac os, system 7.6.1. I need to know precisely which model(s) will work as I need to purchase one, probably off the internet. Thanks for your help! os   Mac OS 8.6 or

  • Runtime Error After Installing Quick Time 7.2 Without Itunes Option

    First I could not open my Itunes b/c I had an application error. So I uninstalled Quick Time and reinstalled Quick Time 7.2 (w/o Itunes). Now I have a "Runtime Error: This Application has requested the Runtime to terminate it in an unusual way. Pleas