I am having a hard time to convert the following curl POST to comply with the angular-file-upload format
curl -H "Content-Type: multipart/form-data" --form "jobSettings=$body" --form "upload=@$file" ${URL}?key=$key
where:
@file - an image file provided as a parameter to the script call
$body - a JSON object that describes job parameters required by the server
Namely, I do not know how to pass --form parameters into formData of angular-file-upload (and even if formData is the right property to use for this task).
PS: I found this solution for posting an image as a JSON multipart/form-data data without relying on angular-file-upload, but I am still not sure how could I format jobSettings parameter within the data property of the $http.post(). I tried the following ways, since according to $http docs I am allowed to set data to String or Object types:
data: 'jobSettings={"analysis": {"paintings": [...]}}'
data: {'jobSettings': {"analysis": {"paintings": [...]}}'
Not working.
Anyone?