I'm delevoping an app on iPhone. My partner sends me a curl command like this
curl -F "clothing_item[photo]=@dress1.jpg" -F "clothing_item[name]= pink_dress" http://www......com/shop_items.json?auth_token=abc_xyz_123
and asks me to implement a function which responses to upload an image to server. I try
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) {
}
});
With imageFile is a file from camera. This post is successful, but there is no image uploaded to server.
Also try:
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) {
}
});
but it doesn't work to.
Any advice was appreciated
Here are a few guides to help you debug though it's really hard to know what exactly is the issue here.