# Advice about upload form

**URL:** <https://www.ruby-forum.com/t/advice-about-upload-form/157680>\
**Category:** Rails\
**Created:** [January 14, 2009, 11:48am UTC](https://www.ruby-forum.com/t/advice-about-upload-form/157680 "2009-01-14T11:48:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![japj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@japj](https://www.ruby-forum.com/u/japj)\
**Post date:** [January 14, 2009, 11:48am UTC](https://www.ruby-forum.com/t/advice-about-upload-form/157680/1 "2009-01-14T11:48:21Z")

</div>

I have Article model that has\_many images.

The edit page for an article has two different forms, one for the  
article itself and another for uploading images. The upload-form  
uploads an image and redirects to the edit page. I did this to make it  
easy to make links to images in the text of the article.

The problem of this design is when a user enters some info in the  
article form and doesn’t submit the form, if the user subsequently  
uploads an images the entered info gets lost.

I’ve thought of a couple of solutions to this problem:

## Upload the images via AJAX

Uploading via AJAX is not really possible but there are some  
workarounds with hidden iFrames. This feels a bit hackish, but it  
might be the best solution.

## Also send the article form when uploading

When uploading a file I could also send the article form to the upload  
action. I could then make a new @article object (without saving it)  
and use that to repopulate the form after the redirect. Problem is, I  
have no idea to send the fields/values from one form together with an  
other form and I can’t find anything about doing this.

Could somebody give me some tips? Maybe I’m going about this all  
wrong, I feel I’m overlooking a simple solution.
