OT: form and multiple pics......pic included!

hi,
i am creating a form for a recipe site and would like to make it as
simple as possible. ive done some researching all day today and it seems
that trying to upload multiple files on 1 form using ajax may not be the
best solution if i want to keep eveything simple and maintanable. if you
look at the attachment, i had a vision where the user would upload a
photo, the code would then return a thumbnail next to the photo that was
just uploaded, and bump the upload photo option down by one, so the user
can upload additional photos.

the problem with this is that the user has not submitted the recipe yet.
but i guess i can get around this by associating each uploaded photo
with a form recipe ID. but if the user decides to cancel the recipe, i
may need to add a cleanup for the photo that was uploaded? would this be
worth pursueing, or maybe it would just be easier that in each user
account, i can just give the user a gallery section where they can
upload photos one by one under each recipe?. what would be the best
solution for this?

http://img86.imageshack.us/my.php?image=formpicske1.gif

Hi…

koloa wrote:

upload photos one by one under each recipe?. what would be the best
solution for this?

I prefer to save the main record first and then get the user to upload
the pictures one by one. What you showed in the picture you posted to
the list will also work. IMO, this is a good design if the user must
submit at least one picture. Your style makes it easy to add that.

On the other hand, if I allow them to upload multiple pictures, I would
usually get the main record in first. Then, when I display the main
recipe, I would give them links to: [Edit this record] | [Add pictures]
… and so on. The link to add pictures would include the parent ID
that would be stored in a hidden field and posted back from the form
that allowed them to upload the picture.

Cheers
Mohit.

hi mohit,
thanks for the reply. that sounds like a good idea and it would also
make things much easier to maintain and implement. acts_as_attachment is
a cool plugin. i will modify that + the logingenrator and walaa, i
should have that capability.

koloa wrote:

hi mohit,
thanks for the reply. that sounds like a good idea and it would also
make things much easier to maintain and implement. acts_as_attachment is
a cool plugin. i will modify that + the logingenrator and walaa, i
should have that capability.

You are most welcome. Just to let you know, I did the implementation
using FileColumn instead of acts_as_attachment and saved images to the
file system. That said, I stored the pictures outside of a public
directory so that they could not be accessed by users who were not
logged in. My understanding is that you will probably not need to
‘protect’ the images if in real fact, they actually are pictures of food
items (and recipes was not your way of simplifying the idea for us to
respond).

Anyway, if you do need to protect the images, store them to a different
directory (i.e., outside your public directory) and have a controller
action that uses send_file to actually stream the file to the browser.

Cheers
Mohit.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs