0

I have a form our guests use to submit a post to a very simple 'message board'.

Now we want to allow the users to upload 1-10 files, but the concern or requirement is to do this outside of the MAIN form submit.

MAIN FORM consists of:

input field 1 input field 2 text area 1 Submit button

I currently have it so there is an initial browse button.. ( below the text are and to the left of the main submit button) and once a file is picked.. and display a link for the user to add another 'browse' field..

What I would like to do is have an UPLOAD button below all these dynamically created browse/file upload fields... that will send all the file data to an external .php script to upload the files in question, and then just return the file path/name back to the main form (maybe in hidden fields? I dont care).. so that these file path/name string values are submitted when the MAIN FORM is submitted..

hope that make sense.

Is this possible? And if so how do I go about this? The concern is to handle the asset uploading/file handling outside of the main form submission so the users details are not lost if something goes wrong with the file upload portion of things.

whispers
  • 962
  • 1
  • 22
  • 48
  • This could lead you in the right direction: http://stackoverflow.com/questions/23705796/ajax-upload-file-files-is-empty-but-files-exists-in-request-header – Damaged Organic Oct 23 '14 at 21:02

1 Answers1

0

You can do this with JQuery and Ajax. There are various plugins are available for this. You can try this - http://plugins.jquery.com/uploadfile/

Hitesh
  • 512
  • 6
  • 24
  • Thanks for replies.. I should have included without any 3rd party scripts or classes. @Grimv01k I'll check out the link now. (appreciate it) – whispers Oct 23 '14 at 22:11
  • I think I'm confused... Every link I have read all talks about doing this on the form submission? Am I mis-understanding? I want to have a separate/unique button (called upload) that does this WITHOUT submitting the main form. I want the upload 'response' to pass back the 1-10 file path/name BACK to the main form (somehow) hidden fields..(whatever) Then when the user is ready/done making the message....they click the SUBMIT button for the main form, that sends all user entered data as well as the returned file paths/name to my database. Anyone have an example for me? :) – whispers Oct 24 '14 at 03:16
  • this link seems to be closest what I want to do....but there is no full example.. just pseud code and snippets http://stackoverflow.com/questions/13245426/upload-image-form-and-another-fill-up-form Anyone know of other examples like this one? – whispers Oct 24 '14 at 03:30