问题
Does anyone know how to upload a file using a form and then have jquery intercept it, modify the file and then send it off with ajax using http PUT instead of POST? I've tried using the jquery form plugin, but it doesn't work with PUTs, has anyone else had to do something like this before? An example would be very helpful.
回答1:
http://homework.nwsnet.de/news/9132_put-and-delete-with-jquery
That is some example code to get you started. You just have to add a method for put
回答2:
Just pass in a "type" key.
$.ajax({
url: 'ajax/test.html',
type: 'PUT'
});
Note that PUT is not supported by all browsers.
来源:https://stackoverflow.com/questions/10840972/uploading-a-file-with-jquery-and-sending-as-a-put