我正在iPhone上开发一个应用程序。我的伙伴向我发送了一个curl命令,如下所示
curl -F "clothing_item[photo]=@dress1.jpg" -F "clothing_item[name]= pink_dress" http://www......com/shop_items.json?auth_token=abc_xyz_123并要求我实现一个响应将图像上传到服务器的功能。我试着
forge.ajax({
url: "http://www........com/shop_items.json",
type: "POST",
dataType: 'json',
data: {
"auth_token": token,
"clothing_item[photo]": imageFile,
"clothing_item[name]": id + "-" + d.getTime().toString()
},
success: function(data) {
},
error: function(error) {
}
});imageFile是一个来自相机的文件。此帖子成功,但没有图片上传到服务器。
还可以尝试:
forge.ajax({
url: "http://www........com/shop_items.json",
type: "POST",
dataType: 'json',
file:[imageFile];
data: {
"auth_token": token,
"clothing_item[photo]": imageFile,
"clothing_item[name]": id + "-" + d.getTime().toString()
},
success: function(data) {
},
error: function(error) {
}
});但这并不适用于。
感谢您的任何建议。
发布于 2012-09-13 00:03:15
这里有一些帮助你调试的指南,尽管很难知道到底是什么问题。
https://stackoverflow.com/questions/12384542
复制相似问题