Wildhoney / EmberDroplet

Ember.js HTML5 file uploading with drag & drop and image/file preview.
http://ember-droplet.herokuapp.com/
MIT License
197 stars 31 forks source link

Is that possible to upload file automatically after insert a pic? #73

Closed kithokit closed 9 years ago

Wildhoney commented 9 years ago

Not currently, but I've just pushed v0.8.8 that should make it easier for you to do that:

/**
 * @module App
 * @class IndexController
 * @uses EmberDropletController
 * @type Ember.Controller
 * @extends Ember.ArrayController
 */
App.IndexController = Ember.Controller.extend(DropletController, {

    // ...

    /**
     * @method didAddFiles
     * @param fileList {Array}
     * @return {void}
     */
    didAddFiles: function didAddFiles(fileList) {
        console.log(fileList);
        this.send('uploadAllFiles');
    }

});

I've added the didAddFiles hook that is invoked when files have been uploaded. You may need to check first if there are any valid files to upload (validFiles computed property), because this will be invoked in all cases.

Please let me know how you get on! :+1: