Skip to content

Commit

Permalink
support multi field as file upload, in this case, the developer can h…
Browse files Browse the repository at this point in the history
…ave more than one field that is managed as cloudinary file upload, the uploaded file will be available in the scope.model[FIELD_KEY]
  • Loading branch information
SaifJerbi committed Jul 20, 2017
1 parent edd47dd commit 4093049
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "asf-cloudinary-file-upload",
"version": "2.1.0",
"version": "2.1.1",
"license": "MIT",
"author": "SaifJerbi",
"main": [
Expand Down
6 changes: 2 additions & 4 deletions dist/asf-cloudinary-file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ CloudinaryFileUploadCtrl.$inject = ['$scope', 'Upload','cloudinary'];
var d = new Date();
cloudinary.config().cloud_name= $scope.form.cloudName;
cloudinary.config().upload_preset = $scope.form.uploadPreset;

$scope.uploadFiles = function(files){
$scope.files = files;
if (!$scope.files) return;
Expand All @@ -46,12 +46,10 @@ CloudinaryFileUploadCtrl.$inject = ['$scope', 'Upload','cloudinary'];
file.progress = Math.round((e.loaded * 100.0) / e.total);
file.status = "Uploading... " + file.progress + "%";
}).success(function (data, status, headers, config) {
$scope.photos = $scope.photos || [];
file.result = data;
file.result.success= true;
$scope.model.image = data;
$scope.photos.push(data);
file.status = "Uploaded";
$scope.model[$scope.form.key] = data;
}).error(function (data, status, headers, config) {
file.result = data;
file.result.failed= true;
Expand Down
2 changes: 1 addition & 1 deletion dist/asf-cloudinary-file-upload.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions src/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CloudinaryFileUploadCtrl.$inject = ['$scope', 'Upload','cloudinary'];
var d = new Date();
cloudinary.config().cloud_name= $scope.form.cloudName;
cloudinary.config().upload_preset = $scope.form.uploadPreset;

$scope.uploadFiles = function(files){
$scope.files = files;
if (!$scope.files) return;
Expand All @@ -45,12 +45,10 @@ CloudinaryFileUploadCtrl.$inject = ['$scope', 'Upload','cloudinary'];
file.progress = Math.round((e.loaded * 100.0) / e.total);
file.status = "Uploading... " + file.progress + "%";
}).success(function (data, status, headers, config) {
$scope.photos = $scope.photos || [];
file.result = data;
file.result.success= true;
$scope.model.image = data;
$scope.photos.push(data);
file.status = "Uploaded";
$scope.model[$scope.form.key] = data;
}).error(function (data, status, headers, config) {
file.result = data;
file.result.failed= true;
Expand Down

0 comments on commit 4093049

Please sign in to comment.