How to properly upload a file in the same form as a parent model?


let’s say you got a Gallery model that has one (to simplify things a
bit for now) Image (attachment_fu model). Gallery has i.e. title and
description, both fields are required. In the “create new gallery
form” you can set title, description and upload the image as well.

What to do if the gallery object validation fails? How do you handle
such situations? Do you create the image anyway, so when user is
redirected back to the form to fix errors, he doesn’t have to upload
the image again or do you require them to upload the image again? It’s
not a big deal if there’s only one image per gallery, but what if
gallery could have many images and user would have to upload again 10
images, just to fix the missing title?

Is there an easy solution for such problem (without making “draft”
objects (like i.e. emails in GMail), or making separate form for
gallery and images)?