Hello,
I am trying to upload a file(s) using this directive:
https://github.com/danialfarid/ng-file-upload
In my code I have something like this:
$upload.http({
method: 'POST',
url: 'url-to-api', //this is the url to my api to where I want
to upload the file(s)
file: files, // this a single file or an array of files
headers: {
'Content-Type': 'multipart/form-data;
boundary=----WebKitFormBoundaryuCJ94zRElBkRB6TJ',
'Access-Control-Allow-Origin': '*'
}
})
.progress(function(evt) {
console.log('progress');
console.log('percent: ' + parseInt(100.0 * evt.loaded /
evt.total));
})
.success(function(data, status, headers, config) {
// file is uploaded successfully
console.log(data);
});
However the API call gets stuck in the OPTIONS method (which has status
200).
Also, what would be the proper way to send files to a $http POST? I want to
try to upload files to the server without using a third party directive
(only plain $http post request).
Thanks
--
JAKE KWON +1 (604) 655 3109
email: [email protected]
- My linkedIn
<http://t.sidekickopen18.com/e1t/c/5/f18dQhb0S7lC8dDMPbW2n0x6l2B9nMJW7t5XZs2BgLPgN2B84bbRYygTW4X9JQW56dT6Zf1JWmXg02?t=http%3A%2F%2Fca.linkedin.com%2Fpub%2Fjake-kwon%2F97%2F9aa%2F727%2F&si=5294421448327168&pi=700bc887-3c30-427f-f1ce-add768577472>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.