Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

blob file attachment limit size/type by Java script

Ramani_apexMar 17 2015 — edited Mar 18 2015

how can live validation for attachment in form region.the following code put in global variable at page attribute and define the static ID as ATT1 in region.its not firing?

$('#ATT1').ready( function() {

    //check whether browser fully supports all File API

    if (window.File && window.FileReader && window.FileList && window.Blob)

    {

        //get the file size and file type from file input field as attachment Item

        var fsize = $('#P4_NWM_DOC_FILE_BINARY')[0].files[0].size;

        var ftype = $('#P4_NWM_DOC_FILE_BINARY')[0].files[0].type;

       switch(ftype)

        {

            case 'image/pdf':

            case 'image/jpeg':

          

                alert("Acceptable image file!");

                break;

            default:

                alert('Unsupported File!');

        }

    }

      else{

        alert("Please upgrade your browser, because your current browser lacks some new features we need!");

          }

      if(fsize>1048576) //do something if file size more than 1 mb (1048576)

         {

            alert(fsize +" bites\nToo big!");

        }

      else{

            alert(fsize +" bites\nYou are good to go!");

          }

  

     else{

        alert("Please upgrade your browser, because your current browser lacks some new features we need!");

        }

    }

);

This post has been answered by Kiran Pawar on Mar 18 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 15 2015
Added on Mar 17 2015
7 comments
861 views