File upload asks for size, type...

User 2907363 Photo

Registered User
1 post

I'm trying to make sure that the file upload component validates the size and type of file before submission. Why would it ask for those limitations on the Properties tab if it isn't going to do anything with them?

How do I make it check before submission using jQuery or javascript?
User 187934 Photo

Senior Advisor
19,163 posts

I use this.
if(this.files[0].size > 10000000){ // 10 meg
$("#docContainer div #fileerror").html("File is too big").css('color', 'red');
}else {
$('#docContainer div #fileerror').html('Valid Image Size').css('color','green');

I then add a custom div with an id of fileerror after export below the file input.
The file type can be added to my code but I'd rather know what type of file your looking at.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
This is a site I built for use in my job.(HTML Editor)
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.