How to upload a file using an HTTP “PUT” using JQuery?

一曲冷凌霜 提交于 2019-11-27 09:04:40

According to : https://github.com/blueimp/jQuery-File-Upload/wiki/Options

method

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.

You should use :

$('#file_upload').fileUpload({
    namespace: 'file_upload_1',
    url: '/path/to/upload/handler.json',
    method: 'PUT'
});
daniellmb

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!