2 Replies Latest reply: Oct 26, 2012 1:29 PM by Ted Martin RSS

    How to restrict uploading files by mime type?

    Ted Martin
      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
        • 1. Re: How to restrict uploading files by mime type?
          Mindmap
          Hi,
          I would like to know if there is an apex-friendly way to "validate" a file-browse item based on mime-type
          How 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
          • 2. Re: How to restrict uploading files by mime type?
            Ted Martin
            Thanks alot. Just got this approach to work with my app and it does the job well.

            Ted