如何使用 HTTP“PUT”上传文件使用 JQuery?
我想使用 JQuery-File-Upload 上传文件,但使用 HTTP“PUT”而不是多部分表单。 根据他们的网站:
- Multipart and file contents stream uploads:
Files can be uploaded as standard "multipart/form-data" or file contents stream (HTTP PUT file upload).
但我在他们的文档中找不到任何关于如何做这个。有人可以帮忙吗?
I would like to upload a file using JQuery-File-Upload, but using HTTP "PUT" instead of multipart-forms. According to their site:
- Multipart and file contents stream uploads:
Files can be uploaded as standard "multipart/form-data" or file contents stream (HTTP PUT file upload).
but I cannot find anywhere in their documentation as to how to do this. Can anyone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据: https://github.com/blueimp/jQuery-File-Upload/维基/选项
你应该使用:
According to : https://github.com/blueimp/jQuery-File-Upload/wiki/Options
You should use :
我也喜欢 REST,但您可能希望确保在需要支持的浏览器上进行良好的单元测试。
http://api.jquery.com/jQuery.ajax/
请求的类型make(“POST”或“GET”),默认为“GET”。注意:这里也可以使用其他 HTTP 请求方法,例如 PUT 和 DELETE,但较旧的浏览器可能不支持它们。
看这个答案
如何使用 JQuery 将数据放入 Rails
I love REST too but you might want to make sure you unit test well on the browsers you need to support.
http://api.jquery.com/jQuery.ajax/
The type of request to make ("POST" or "GET"), default is "GET". Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they may not supported by older browsers.
See this answer
How do I PUT data to Rails using JQuery