admin管理员组文章数量:1357405
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.
本文标签: javascriptHow can I upload files without using an HTML ltformgtStack Overflow
版权声明:本文标题:javascript - How can I upload files without using an HTML <form>? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744015839a2576310.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论