JS FileTransfert return Http 411
JS FileTransfert return Http 411
我正在尝试更新配置文件图片,它在本地服务器上工作,但在远程服务器上不工作,在最后一个上,我收到了Http 411
响应
function imageReceived(imageURI) { // this is done after taking a picture
var options = new FileUploadOptions();
options.fileName = 'profilePic.jpg';
options.headers = {Authorization: 'Token token=' + profile.accessToken};
var ft = new FileTransfer();
ft.upload(imageURI,
url("/api/v1/update_avatar"), // url() is a function that returns the full path
function(result) {
alert(result);
},
function(error) {
alert( JSON.stringify(error));
},
options);
}
PS:
profile
是我已经拥有的类,accessToken具有正确的值- 本地服务器是HTTP,远程服务器是HTTPS,这有区别吗
我做错了什么或错过了什么??
任何帮助都将不胜感激!!
您必须将Content-Length
标头与请求一起发送。
发件人http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html:
411 Length Required
The server refuses to accept the request without a defined Content- Length. The client MAY repeat the request if it adds a valid Content-Length header field containing the length of the message-body in the request message.
正如您在这篇文章中所看到的,您将不得不与您的托管公司进行讨论。
Web服务器(运行网站)认为HTTP数据流由客户端发送(例如您的Web浏览器或我们的CheckUpDown机器人)应包括"内容长度"规范。这通常是仅用于导致在Web服务器,而不是从中检索数据。
修复411个错误-通用
此错误很少出现在大多数Web流量中,尤其是当客户端系统是一个Web浏览器。问题只能通过以下方式解决检查您的客户端系统正在尝试做什么,然后与讨论您的ISP为什么Web服务器需要"内容长度"规范。
相关文章:
- Meteor如何接收HTTP请求
- 在我的情况下,如何进行http请求
- //而不是在src=“”上使用http://"属性
- 我无法使用angularJs($http)访问服务器
- AJAX简单错误.XMLHttpRequest无法加载http://localhost/mpl/getPage.php.
- 如何将PHP get查询转换为Meteor's HTTP.get()
- 角度异步http自动完成
- 什么's本地node.js服务器和python简单http服务器之间的区别
- 角度http服务器页面刷新404s
- http.listen()在运行时接受终端命令
- jquery if语句返回return wong语句
- 函数在return语句之前返回空对象
- IIS动态HTTP响应标头
- Javascript Return and if/else
- JS FileTransfert return Http 411
- 在创建工厂服务时,return$http.post在angular中到底意味着什么
- $http在谷歌chromeangularjs上发布return 400
- NodeJS return http.request
- AngularJS http return value
- angular js $http return true or false