# Validation errors and file uploads

**URL:** <https://discuss.rubyonrails.org/t/validation-errors-and-file-uploads/22620>\
**Category:** rubyonrails-talk\
**Created:** [January 3, 2008, 6:06pm UTC](https://discuss.rubyonrails.org/t/validation-errors-and-file-uploads/22620 "2008-01-03T18:06:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Kohout](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@Michael\_Kohout](https://discuss.rubyonrails.org/u/Michael_Kohout)\
**Post date:** [January 3, 2008, 6:06pm UTC](https://discuss.rubyonrails.org/t/validation-errors-and-file-uploads/22620/1 "2008-01-03T18:06:26Z")

</div>

I've got a form that contains a number of textfields, as well as a file upload element.

I've noticed that this field doesn't retain it's data after validation errors. While I know html/http doesn't allow form fields to be pre- populated per se, it can be faked by stuffing it into the session. Yuck.

Is there any accepted pattern/best practice for faking it that doesn't require the file to be tacked to the session?

---

<div class="post-metadata">

**Author:** ![Michael\_Kohout](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@Michael\_Kohout](https://discuss.rubyonrails.org/u/Michael_Kohout)\
**Post date:** [January 3, 2008, 6:43pm UTC](https://discuss.rubyonrails.org/t/validation-errors-and-file-uploads/22620/2 "2008-01-03T18:43:30Z")

</div>

I should say that I'm using rails 1.2.6, and this is self-rolled file code in the controller and model.
