3 Replies Latest reply: Sep 20, 2012 12:17 PM by Hari_639 RSS

    How to filter the file type and size when uploadind files into APEX

    leinadjan
      Hi,

      I was wondering how I can do to validate the size of a file, before moving it to my table ? I'd like to filter the file type, but for this one, I think I can use regular expressions in a validation process.

      I don't know if there is a way to read the file size even before sending it into the temporary file table.

      Thank you

      Leinad
        • 1. Re: How to filter the file type and size when uploadind files into APEX
          Hari_639
          Hello Leinad,

          AFAIK, you have to create an APEX validation (PL/SQL returns Boolean or Returns error text), which will query the file details from apex_flow_files table. Here you can get filetype and size etc.

          So just validate and if any validation fails, then delete the file from apex_flow_files and riase error message.

          Regards,
          Hari

          P.S. Please note that, if there are other apex validations on your page and if they fail, still apex will load the file into apex_flow_files table. So it's good idea to create a validation (PL/SQL) which will fire (condition) when inline validation errors occured. Make sure that this is the LAST validation on your page in sequence. And here you can write code to delete the file from apex_flow_files table.

          Edited by: Hari_639 on Sep 20, 2012 10:09 PM
          • 2. Re: How to filter the file type and size when uploadind files into APEX
            leinadjan
            So whatever I'm doing the file will be uploaded, so I must do it in two steps.


            Thank you

            Leinad
            • 3. Re: How to filter the file type and size when uploadind files into APEX
              Hari_639
              Yes, once the page is submitted successfully => file uploaded to apex_flow_files table successfully. And it's available for all after submit actions.

              I have requested for new attrbute for file-brose item at [url https://apex.oracle.com/pls/apex/f?p=55447]Oracle Application Express Feature Requests. Hope APEX Team will consider this request :)

              Search "Feature Requests" with "New attribute for file-browse item"

              Regards,
              Hari