Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Blueimp has an AngularJS version of jQuery File Upload available.</p> <p>It includes a <code>fileUpload</code> directive and a <code>FileUploadController</code> with a <code>submit()</code> method that you can call manually.</p> <p>You can see a working version at <a href="http://blueimp.github.io/jQuery-File-Upload/angularjs.html">http://blueimp.github.io/jQuery-File-Upload/angularjs.html</a>.</p> <p>One thing you should pay attention to: make sure you load all .js files from the example in the correct order to avoid problems (cf. source of the example page).</p> <p>Hope that helps!</p> <hr> <p>UPDATE AFTER YOUR COMMENT:</p> <p>When using the AngularJS version of jQuery File Upload, you create a form tag with the <code>file-upload</code> attribute like this:</p> <pre><code>&lt;!-- Create a file upload form with options passed in from your scope --&gt; &lt;form data-file-upload="options" data-ng-controller="YourController"&gt; &lt;!-- This button will trigger a file selection dialog --&gt; &lt;span class="btn btn-success fileinput-button" ng-class="{disabled: disabled}"&gt; &lt;span&gt;Add files...&lt;/span&gt; &lt;input type="file" name="files[]" multiple="" ng-disabled="disabled"&gt; &lt;/span&gt; &lt;!-- This button will start the upload --&gt; &lt;button type="button" class="btn btn-primary start" data-ng-click="submit()"&gt; &lt;span&gt;Start upload&lt;/span&gt; &lt;/button&gt; &lt;form&gt; </code></pre> <p>Then in your controller you can assign the options for the jQuery File Upload like this:</p> <pre><code>angular.module('yourModule') .controller('YourController', [$scope, function($scope){ // Options you want to pass to jQuery File Upload e.g.: $scope.options = { maxFileSize: 5000000, acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i }; }]); </code></pre> <p>You can assign the <code>submit()</code> handler to any <code>ng-click</code> attribute as long as it is inside the form (and thus can access the method).</p> <p>Let me know if you need further help...</p> <hr> <p>EXTRA SAMPLE CODE FOR SUCCESS CALLBACK:</p> <p>If you need to run a callback function after <strong>all</strong> uploads have been completed, you can listen to the <code>fileuploadstop</code> event that is broadcasted by Blueimp:</p> <pre><code>// Listen to fileuploadstop event $scope.$on('fileuploadstop', function(){ // Your code here console.log('All uploads have finished'); }); </code></pre> <p>Hope that helps!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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