Filter without uploading

Started by Mathieu_B3 replies8 views
Mathieu_BOriginal post
#1

Archived from the Transloadit support forum. Originally posted on December 11, 2012; details may be outdated, see our docs for current behavior. Original thread

Hello!

I’m trying to restrict a form by declining every non-images files.

I’m using the file filter robot, but it seems to be uploading the file before throwing the error.

So for example, if the user try to upload a 1GB video on my form, it will upload the 1GB and after shows the “Only images are accepted” message…

Is it normal?

Thanks,
Mathieu

tim-kos
#2

Yes that’s normal as we can’t fully analyze the file prior to the upload.

You can however check use jQuery validate and check for the file extension (the contents of your file input field) prior to upload. See an example integration with jQuery validate here: https://transloadit.com/demos/misc/integrate-with-jquery-validate

kind regards,
Tim

Co-Founder Transloadit
@tim_kos

Mathieu_B
#3

Hello!

I did check the extension with jQuery finally, thanks Tim, you can close that 🙂

tim-kos
#4

Alright, closing.