advancedforms / advanced-forms

WordPress plugin to create forms using Advanced Custom Fields
75 stars 14 forks source link

Uploader does not validate for non-logged in users #74

Closed ghost closed 4 years ago

ghost commented 4 years ago

If you create a file field and set a limit to file size, you can still upload the file and submit it but it doesnt store it anywhere

hacknug commented 4 years ago

@drwhoooois did you find any way to work around the issue?

fabianlindfors commented 4 years ago

Hi, @hacknug!

I'm currently working on improving support for the basic uploader and hopefully fixing this issue. Would you be willing to test it out for me?

hacknug commented 4 years ago

Sure! Let me know how I can help. Will be AFK today but can take a look at this during the weekend 👍

fabianlindfors commented 4 years ago

Great! I just pushed these changes to Github, please download the plugin from here. Let me take a moment to explain what I have done.

This change is server-side and not client-side. It will stop any submissions with invalid uploads but it will not provide for a good user experience. If an upload is invalid then the user will be shown an error message on a new page which is inconsistent with how other validation works.

The reason for this is that ACF does not support client-side validations of file uploads in the general case. I've been trying to implement this myself but unfortunately I haven't yet found a way. I recommend you implement it manually for your form using the ACF JS API: https://www.advancedcustomfields.com/resources/javascript-api/.