JQuery - Get Uploaded File size - File size validation


/ Published in: jQuery
Save to your folder(s)

File size validation


Copy this code and paste it in your HTML
  1. /*
  2. *
  3. * Function to validate File size
  4. *
  5. **/
  6. function findSize(field_id)
  7. {
  8. var fileInput = $("#"+field_id)[0];
  9. byteSize = fileInput.files[0].fileSize;
  10. return ( Math.ceil(byteSize / 1024) ); // Size returned in KB.
  11. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.