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
--
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.