Hi all, Is there an easy way to not lose the file field input from the user after a validation error? It pisses people off to have to choose their files again just because some other field didn''t pass a validation. I''ve googled this and just haven''t come up with much of anything. Thanks.
I''m pretty sure you can''t do that for security reasons. Nothing to do with rails of course it''s just a browser thing. Just imagine if you could pre-fill file upload fields! Good luck! Tim On Jun 18, 12:19 pm, "Mark W." <alt_rock_hac...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> Hi all, > > Is there an easy way to not lose the file field input from the user > after a validation error? It pisses people off to have to choose > their files again just because some other field didn''t pass a > validation. I''ve googled this and just haven''t come up with much of > anything. > > Thanks.
Andrew Timberlake
2009-Jun-19 06:24 UTC
Re: How to persist file upload fields after a validation error.
> On Jun 18, 12:19 pm, "Mark W." <alt_rock_hac...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote: >> Hi all, >> >> Is there an easy way to not lose the file field input from the user >> after a validation error? It pisses people off to have to choose >> their files again just because some other field didn''t pass a >> validation. I''ve googled this and just haven''t come up with much of >> anything. >> >> Thanks.I save the file and store it''s location in a session variable, then you can get to the file again on resubmission. You will need a strategy to clean up orphaned files where the user has not re-submitted the form Andrew Timberlake http://ramblingsonrails.com http://MyMvelope.com - The SIMPLE way to manage your savings