0

I am trying to grab the file size, of a selected file, before a user submits the form. I am trying to use JQuery to do this so that I can prevent form submission if the file size is too big. But I can't get my code to work right.

My Jquery on form submit:

var size = $("photo-input")[0].files[0].size; 

What could I be doing wrong?

1

1 Answer 1

1

You should prefix #, assuming you want to select on the basis of ID

 var size = $("#photo-input")[0].files[0].size; 

HTML has no element as photo-input

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.