Putting Transloadit inside an existing form.

Archived from the Transloadit support forum. Originally posted on February 22, 2011; details may be outdated, see our docs for current behavior. Original thread

I’m trying to replicate the experience of input[type=“file”] with Transloadit. Presently I upload files with Transloadit and write the result to hidden fields inside a different form. This works pretty well, but I’d like to get the Transloadit functionality visually inside an existing form, similar to how input[type=“file”] would look.

Hopefully this little diagram explains it: http://pastie.org/1594186

Since the Transloadit JQuery api depends upon a form element, that Transloadit form has to placed outside other forms. I’d like to just use just a file input, and provide the params data through javascript. That way I could position the file field inside the other form, just like I would with a typical file input.

I’m not married to that implementation, the whole point is just to visually replicate the experience of having a file upload field in the middle of a form that contains other fields. But it is difficult to position elements from one form inside another. So, if you have any suggestions on how to accomplish that, I’d be open to them. Thanks!

If I understand you correctly, I think you could just use .transloadit() on your current form and don’t need a dedicated Transloadit form.

Setting the field option to true (http://transloadit.com/docs/configuring-the-jquery-plugin) will make sure all your current form fields are sent to us, and then end up in the response (http://transloadit.com/docs/the-response) as well.

This way you’d just have 1 form. Does that answer your question?

I’ll check that out, thanks, I wasn’t thinking along those lines.

My fear is that wouldn’t allow for files to be uploaded without the form being submitted, which I want but didn’t describe well above. But I’ll look into it, this might work.

Alright I’ll close this ticket for now. Please let me know if you require further assistance.