用jquery上传文件并作为PUT发送 [英] Uploading a file with jquery and sending as a PUT

查看:151
本文介绍了用jquery上传文件并作为PUT发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何使用表单上传文件,然后让jquery拦截它,修改文件,然后使用http PUT而不是POST发送给ajax?我已经尝试过使用jQuery表单插件,但它不适用于PUT,有没有其他人不得不这样做之前?一个例子是非常有用的。

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.

推荐答案

只需传入type键即可。

Just pass in a "type" key.

$.ajax({
  url: 'ajax/test.html',
  type: 'PUT'
});

请注意,所有浏览器都不支持PUT。

Note that PUT is not supported by all browsers.

这篇关于用jquery上传文件并作为PUT发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆