I'm currently working on a custom ContentApp that needs to send text and (optional) images to an API.
I've created the API first and everything works fine with Postman.
However, when I try and send data from the ContentApp the images are not received in the API.
I'm trying to use the Upload service in my AngularJs controller to send an array of files which looks like this:
Upload.upload({
url: "/umbraco/api/supportmodule/createTicket",
fields: {
//These are additional fields you can send and use as FormData
'name': $scope.nameField.value,
'email': $scope.emailField.value,
'subject': $scope.subjectField.value,
'description': completeMessageField,
'priority': $scope.priorityField.value,
},
file: $scope.filesHolder.value
})
The HTML seems to work correctly and look like this:
Uploading multiple images from ContentApp
I'm currently working on a custom ContentApp that needs to send text and (optional) images to an API.
I've created the API first and everything works fine with Postman. However, when I try and send data from the ContentApp the images are not received in the API.
I'm trying to use the Upload service in my AngularJs controller to send an array of files which looks like this:
The HTML seems to work correctly and look like this:
I'm using a
List<IFormFile>
value in the model that is null after sending the post request (this is correctly filled when using Postman)Can someone explain to me how to upload multiple files and make sure they are bound to the model correctly ?
Hi,
i'm not sure if this is the solution, but have a look at "transformRequest" parameter in angularJS.
An example of this is at StackOverflow.
is working on a reply...