Uploading a file with jquery and sending as a PUT

好久不见. 提交于 2019-12-13 03:54:19

问题


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

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