如何进行文件上传并将结果返回到同一页面? [英] How can I do a File Upload and return results to the same page?
问题描述
我需要上传文件并将结果返回到同一页面. <form>
也有几个将在POST中发送的数据字段.
I need to do a file upload and return the results to the same page. The <form>
also has a couple of data fields that will be sent in the POST.
由于有限的浏览器支持,我无法使用HTML 5,不幸的是,我看到的AJAX文件上传解决方案都使用HTML5.我可以使用Javascript进行POST,但没有看到文件上传完成的过程,例如这个.
I can't use HTML 5 due to limited browser support, and unfortunately the AJAX file upload solutions I've seen all use HTML 5. I could do the POST in Javascript but I haven't seen a file upload done like this.
我的服务器是用Java编写的,但这没关系.
My server is written in Java but that shouldn't matter.
是否有一种方法可以获取这种POST的结果以返回同一页面?
Is there a way to get the results of this kind of POST to return to the same page?
推荐答案
我最终使用了 jQuery Form Plugin .它支持使用以下选项在标头中发送基本身份验证凭据:
I ended up using the jQuery Form Plugin. It supports sending basic auth credentials in the header with this option:
headers : { Authorization: basicAuthCredentials}
我也需要做.
这篇关于如何进行文件上传并将结果返回到同一页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!