0

I have a problem.

I've got a form with some input fields. One of them is a file upload field. When the user submits the form, every field will be validated and the page gets reloaded with the error messages (inline errors), but all fields still showing the users input but the file input forgets the selected file. Is there any solution to fix this problem?

Thank you!

0

1 Answer 1

0

Their is no valid "value" parameter on an input with file field type anymore, and because the field is populated through browser interaction with the operating system, it is probably not possible to tell the browser to repopulate that field.

There's also a host of vulnerabilities from letting a server tell your browser to relocate a file on request on a local machine. That type of stuff usually requires custom browser extensions. I won't even try to grok some of the possibilities their.

What you want to do, is to force validation before submission. By making the user fill in all fields before moving forward, you can prevent these issues. It sounds like your form not repopulating that field is a problem for your particular clientele. It will be a pain, but can stop some of these issues.

Another option is to upload the file on the spot. However, I don't think there is any field type addons for FreeForm to connect it to something like Assets. You could probably develop one (and sell it too, I bet!).

2
  • I would like to thank you for helping me. I tried to put fileupload into my contact form, but after your answer I think I skip this idea :)
    – Wishmylove
    Commented Sep 10, 2015 at 11:43
  • No problem! The only way to allow your file upload to remain is to asynchronously upload it before form submission (my last paragraph). Could you give my answer an upvote :) ? I wouldn't accept it as someone else may still chime in with a better answer, but I doubt it.
    – jrothafer
    Commented Sep 10, 2015 at 12:16

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.