FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Repopulating $_FILES upon failed validation
#1
I've been reading up on input type file around the net and it seems that it's a security issue, and thus not possible, to repopulate the input type file value with anything at any time.

But I have a problem...in my form, I'm doing just server-side validation right now and when something fails, my uploads go away. I checked and saw that the $_FILES array was getting sent back to the form, so I thought I could use that to repopulate the files that the user already selected...but no luck.

Is there any way I can accomplish repopulating uploaded file fields when a form doesn't validate?

It's really a pain for a user to have to go through choosing all of their files again just because an email address was mis-spelled, you know?

Thanks for the help!
Reply
#2
Hi Jaace,

Unfortunately not... at least, not without a lot of customization. Form submissions that contain a file are sort of "one shot deals". From a server-side perspective, you have access to that uploaded file at that one time only. You can't access the uploaded file on the subsequent form submit - this is forbidden, mostly for security reasons.

But this is very reasonable request. I've logged it as a bug, here:
http://bugs.formtools.org/index.php?cmd=view&id=211

To be perfectly honest, I'm not sure how to elegantly solve it. I think it may need a custom function added. Blurgh, very messy.

Sorry, Jaace. I'll have to investigate this in an upcoming version of the API.

- Ben
Reply
#3
No worries Ben! Thanks for considering it though :-). If I come up with anything myself I'll be sure to send it over your way.

Cheers!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)