1

How can I validate file size from client side. It can be controlled via controller like,

if (file.ContentLength > 1048600) { } also on client side I can control name and extension of file. But how control size?

<input type="file" name="file" id="file" />

Thanks

1 Answer 1

3

I dont think there is currently a cross browser way to do what you want, check this question

This can work only in webkit based browsers for example

var size = document.getElementById('file').files[0].size;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.