# Validation errors and file uploads

**URL:** <https://www.ruby-forum.com/t/validation-errors-and-file-uploads/124916>\
**Category:** Rails\
**Created:** [January 3, 2008, 7:07pm UTC](https://www.ruby-forum.com/t/validation-errors-and-file-uploads/124916 "2008-01-03T19:07:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrkohrea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4491bb/32.png) [@mrkohrea](https://www.ruby-forum.com/u/mrkohrea)\
**Post date:** [January 3, 2008, 7:07pm UTC](https://www.ruby-forum.com/t/validation-errors-and-file-uploads/124916/1 "2008-01-03T19:07:12Z")

</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:** ![mrkohrea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4491bb/32.png) [@mrkohrea](https://www.ruby-forum.com/u/mrkohrea)\
**Post date:** [January 3, 2008, 7:43pm UTC](https://www.ruby-forum.com/t/validation-errors-and-file-uploads/124916/2 "2008-01-03T19:43:46Z")

</div>

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