in a web application I am building I need to upload photos without using a form, otherwise it will e up with form embedded in an outer from which is not permitted in XHTML.
I think uploading files is what jQuery.post should be able to do, but I currently can't figure out how to do this using jQuery.
in a web application I am building I need to upload photos without using a form, otherwise it will e up with form embedded in an outer from which is not permitted in XHTML.
I think uploading files is what jQuery.post should be able to do, but I currently can't figure out how to do this using jQuery.
Share Improve this question edited Oct 11, 2008 at 17:20 Jason Bunting 59k16 gold badges104 silver badges94 bronze badges asked Oct 11, 2008 at 7:31 btw0btw0 3,6367 gold badges36 silver badges36 bronze badges 3- Why is XHTML significant in uploading a file? – AnthonyWJones Commented Oct 11, 2008 at 8:02
- XHTML does not allow nested form. – btw0 Commented Oct 11, 2008 at 11:30
- ...for good reason. is there a way you can possibly avoid nesting forms? – nickf Commented Oct 12, 2008 at 10:09
4 Answers
Reset to default 5take a look at swfupload, it's a pretty nifty little app that should acplish what you want. otherwise, you could separate out the forms, and just use css/javascript to reposition them if necessary.
With jQuery.post you will be only able to send key/value pairs to the server in a POST Request, However you can use plugins like jQuery Multiple File Upload Plugin.
Have you check out the fieldset element? Why not wrap your input elements in that, then use jQuery to dynamically assign 'submit' functionality, as opposed to trying to attach it to the overall form element?
I can confirm that jquery.fileupload does not need a form to upload an image, in fact the file upload fields (which fileupload wants) can be in a form, you have to use the manual aspects such as defining you url: for where the file will be sent, and probably the add: event.
Just a note, and I'm quite sure that my use is probably a little wrong, but the other form elements along with all the file upload data will be sent, but it's trivial to simply get the file data and ignore the rest. And yes my form submission for all the other non-file-upload fields work fine with my submit action. Hope this helps.