I am working on getting images uploaded to an existing kinvey collection but am having a ton of trouble getting kinvey to play nice with ng-file-upload.
ng-file-upload uses this:
html:
JS:
angular.module('myApp', ['angularFileUpload']);
var MyCtrl = [ '$scope', '$upload', function($scope, $upload) {
$scope.onFileSelect = function($files) {
//$files: an array of files selected, each file has name, size, and type.
for (var i = 0; i var $file = $files[i];
$upload.upload({
url: 'my/upload/url',
file: $file,
progress: function(e){}
}).then(function(data, status, headers, config) {
// file is uploaded successfully
console.log(data);
});
}
}
}];
and I am struggling with getting the kinvey upload to work with it. I have it working for a php server but that doesn't help me. Can someone show me how to implement kinvey in this?
console.log('[$upload] received error: ' + JSON.stringify(err));
});
return promise;
});
O
OhmzTech
said
over 6 years ago
Are you getting either of the console.logs in your second post example? If not, can you try adding another error callback to the returned promise?
A working example on something like jsfiddle.net for the AngularJS bit would be helpful, or at least something more complete posted here that shows your AngularJS code together with Kinvey code?
d
dualpandas
said
over 6 years ago
http://jsfiddle.net/p37bn/9/
for how I currently have it set up to save the url to the kinvey collection because I cant figure out image uploads.
Instead of a text input box I want to be able to select an image to upload.
M
Mark
said
over 6 years ago
I’ve created a small snippet [here](https://gist.github.com/vseventer/3835e6cfc5353259afe8). It uploads an image successfully. Please make sure you use the [File Upload plugin](https://github.com/danialfarid/angular-file-upload).
dualpandas
I am working on getting images uploaded to an existing kinvey collection but am having a ton of trouble getting kinvey to play nice with ng-file-upload.
ng-file-upload uses this:
html:
JS:
angular.module('myApp', ['angularFileUpload']);
var MyCtrl = [ '$scope', '$upload', function($scope, $upload) {
$scope.onFileSelect = function($files) {
//$files: an array of files selected, each file has name, size, and type.
for (var i = 0; i
var $file = $files[i];
$upload.upload({
url: 'my/upload/url',
file: $file,
progress: function(e){}
}).then(function(data, status, headers, config) {
// file is uploaded successfully
console.log(data);
});
}
}
}];
and I am struggling with getting the kinvey upload to work with it. I have it working for a php server but that doesn't help me. Can someone show me how to implement kinvey in this?
thanks.