Bit stuck on this one, need to upload an image and json together using a multipart form.. not sure how to sent the content type headers or upload the image.. think i need to convert to blob.. at the moment im just sending the data i get from the file input field.
any suggestion would be great thanks
$http({
method: 'POST',
url: URL,
headers: { 'Content-Type': false },
transformRequest: function (data) {
console.log(data);
var formData = new FormData();
formData.append("formatteddata", angular.toJson(data.model));
formData.append('media', Image)
return formData;
},
data: { model: shoutoutData, image: shoutoutImage}
}).
success(function (data, status, headers, config) {
alert("success!");
}).
error(function (data, status, headers, config) {
alert("failed!");
});