javascript - 使用 Javascript XMLHttpRequest 将图像发布到 Picasa

标签 javascript ajax post xmlhttprequest picasa

我正在尝试使用 JavaScript 将图像发布到 picasa。我已经获得了所需的 token 。但是当我发帖时,我收到错误“204 无内容”

这是我的代码。

function send()
{
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function ()
{
if(xhr.readyState == 4)
alert(xhr.status);
}
xhr.open("POST","https://picasaweb.google.com/data/feed/api/user/default/albumid/default", true);
var type = document.getElementById('file').files[0].type;
xhr.setRequestHeader('Accept','message/x-jl-formresult');
xhr.setRequestHeader("content-type",type);
xhr.setRequestHeader('Content-Length',document.getElementById('file').files[0].size);
xhr.sendAsBinary(document.getElementById('file').files[0].getAsBinary());

}

最佳答案

你知道204是什么意思吗?

204 No Content The server successfully processed the request, but is not returning any content

http status codes

服务器说它很好,没有什么可返回的。

关于javascript - 使用 Javascript XMLHttpRequest 将图像发布到 Picasa,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7194073/

相关文章:

php - HTTP 500 错误但确实将数据存储到数据库 - Wordpress new-post.php、post.php、edit-post.php 在更新数据结构和插件后无法正常工作

node.js - 发布的数据是否应该从后端返回? Angular + Node

javascript - Jquery 中的复选框选中问题

javascript - 使用 jquery 和 ASP.NET 异步上传文件

javascript - 不使用 https 能否安全地将信息发送到服务器?

c# - 使用 C# 和 PHP 更新 mysql

Javascript:打开和关闭输入标签仅适用于表单中的最后一个标签

javascript - 捕获和冒泡事件

javascript - 为什么内存中的 JavaScript 对象文字比 JSON 形式的文本文件大小大得多?

javascript - 加载必要 JSON 数据的最佳实践 : jquery's $(document). read() 钩子(Hook)?在页面的 <HEAD> 中?