I'm trying to upload files to azure through browser using Web Api and angular, I've followed this example: https://ppolyzos.com/2016/02/07/upload-a-file-to-azure-blob-storage-using-web-api/
I send the request from angular service (not sure if this is the right implementation!):
this.PostFiles = function (files) {
var req = $http.post('/api/GENAccounts/UploadFile', files);
return req;
}
and the files
is an array of files selected by the user
<input type="file" ngf-select="uploadFiles($files, $invalidFiles)" multiple accept="image/*" ngf-max-height="1000" ngf-max-size="3MB" />
I even followed the same test described in the article by passing simple string via Postman, and it still throw the same error, and always this statement return true
if (!Request.Content.IsMimeMultipartContent("form-data"))
{
throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
}
In his implementation, he doesn't define the object POSTed in the web api which is unusual behavior to me. So how to pass the files to web API, and in any format that can pass this form-data
test?