Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can try <a href="https://github.com/danialfarid/ng-file-upload" rel="nofollow noreferrer">ng-file-upload</a> angularjs plugin (instead of <a href="https://github.com/twilson63/ngUpload" rel="nofollow noreferrer">ng-upload</a>).</p> <p>It's fairly easy to setup and deal with angularjs specifics. It also supports progress, cancel, drag and drop and is cross browser.</p> <p>html</p> <pre><code>&lt;!-- Note: MUST BE PLACED BEFORE angular.js--&gt; &lt;script src="ng-file-upload-shim.min.js"&gt;&lt;/script&gt; &lt;script src="angular.min.js"&gt;&lt;/script&gt; &lt;script src="ng-file-upload.min.js"&gt;&lt;/script&gt; &lt;div ng-controller="MyCtrl"&gt; &lt;input type="file" ngf-select="onFileSelect($files)" multiple&gt; &lt;/div&gt; </code></pre> <p>JS:</p> <pre><code>//inject angular file upload directives and service. angular.module('myApp', ['ngFileUpload']); 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 &lt; $files.length; i++) { var file = $files[i]; $scope.upload = $upload.upload({ url: 'server/upload/url', //upload.php script, node.js route, or servlet url data: {myObj: $scope.myModelObj}, file: file, }).progress(function(evt) { console.log('percent: ' + parseInt(100.0 * evt.loaded / evt.total)); }).then(function(response) { var data = response.data; // file is uploaded successfully console.log(data); }); } }; }]; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload