Archived from the Transloadit support forum. Originally posted on March 18, 2011; details may be outdated, see our docs for current behavior. Original thread
Here’s what I’m trying to do:
I have a form with one text area, and one file upload element. I’d like to have the user enter “notes” in the textarea and upload zero or several files. The textarea maps to a table called “projects”. Each project record can have zero or many “project_files”.
What is the best way to setup my form so that if a user enters “notes” a project record is created, and then for each uploaded file, a child “project_files” record is created that maps to the “project” record? I’m using the jQuery plugin, so the form posts the files to transloadit first. I’d like to create a row for each file uploaded and point it to the location of the file (at s3), but since the “project” parent record hasn’t been created yet, I’m not sure how to set my foreign key.
I assume this is a common use case where a parent/child form needs to be processed on our server as well as post to transloadit. Any best practices on how to set this up so the database records can be inserted properly? I assume this can be done by using the right combination of ‘notify_url’, ‘autoSubmit’, ‘wait’, etc, but I just can’t sort it out yet. Hopefully, I’m explaining the scenario properly.
Thanks for the help.