如何使用HTTP“PUT”上传文件使用JQuery? [英] How to upload a file using an HTTP "PUT" using JQuery?
本文介绍了如何使用HTTP“PUT”上传文件使用JQuery?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用JQuery-File-Upload上传文件,但使用HTTPPUT而不是多部分表单。 根据他们的网站:
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?
推荐答案
根据: https://github.com/blueimp/jQuery-File-Upload/wiki/Options
方法
method
用于
的HTTP请求的方法将文件发送到服务器。可以
POST(multipart / formdata文件上传)
或PUT(流文件上传)。
接受字符串或函数
返回一个字符串。
The method of the HTTP request used to send the file(s) to the server. Can be POST (multipart/formdata file upload) or PUT (streaming file upload). Accepts a String or a function returning a String.
你应该使用:
$('#file_upload').fileUpload({
namespace: 'file_upload_1',
url: '/path/to/upload/handler.json',
method: 'PUT'
});
这篇关于如何使用HTTP“PUT”上传文件使用JQuery?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文