angularjs - Jquery file upload angular version - multiple file upload on the same page -


cheers,

here example how use jquery-file-upload plugin angularjs how use jquery file upload angular version?

but! if on same page need few widgets?

<form class="fileupload" action="server/php/" method="post" enctype="multipart/form-data">     <!-- ... --> </form> <form class="fileupload" action="server/php/" method="post" enctype="multipart/form-data">     <!-- ... --> </form> 

this example works good, except:

  1. callbacks. using $scope.$on() not quite right. how specify specific callbacks each widget?

  2. drag-n-drop. seems drag-n-drop area shared between 2 widgets, when drop file @ place on page both events triggered. again, how specify drop areas each one?

my though jquery-file-upload can cover requirements , poor jquery file upload angularjs plugin

not sure how fix angular-file-upload directive might save hassle. lightweight , simple use , supports non-html5 browsers fileapi flash shim. supports drag&drop , upload progress.

<div ng-controller="myctrl">   <input type="file" ng-file-select="onfileselect($files)" multiple>   <div class="drop-box" ng-file-drop="onfileselect($files);" ng-show="ddsupported">drop files here</div>   <div ng-file-drop-available="dropsupported=true" ng-show="!ddsupported">html5 drop file not suported></div> 

js:

//inject angular file upload directive. angular.module('myapp', ['angularfileupload']);  var myctrl = [ '$scope', '$upload', function($scope, $upload) {   $scope.onfileselect = function($files) {     //$files: array of files selected, each file has name, size, , type.     (var = 0; < $files.length; i++) {       var $file = $files[i];       $upload.upload({         url: 'my/upload/url',         file: $file,         progress: function(e){}       }).then(function(data, status, headers, config) {         // file uploaded         console.log(data);       });      }   } }]; 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -