I don't know how to use the callback to show in ember how many files were uploaded, here is my code.
route:
import Ember from "ember";
const get = Ember.get;
const set = Ember.set;
export default Ember.Route.extend({
actions: {
uploadImage: function (file) {
file.read().then(function (url) {
if (get(image, 'url') == null) {
set(image, 'url', url);
}
});
file.upload('http://localhost:3000/upload').then(function (response) {
set(image, 'url', response.headers.Location);
return image.save();
}, function () {
image.rollback();
});
}
}
});
and a node.js with node-pluploader
var pluploader = new Pluploader({
uploadLimit: 16,
uploadDir: 'saved/'
});
pluploader.on('fileUploaded', function(file, req) {
console.log(file);
});
pluploader.on('error', function(error) {
throw error;
});
router.post('/upload', function(req, res){
pluploader.handleRequest(req, res)
});
Where can I put the callback in the code? I've tried with res.send in the router.post function but it won't work :/
Greetings, Rafał
Aucun commentaire:
Enregistrer un commentaire