Download Sails JS Skipper v0.10.5 Files

I upload files with skipper, everything works fine, but I have a problem with save parameter. I assign its value using a function, but it doesn't work, how can I assign the value to req. param ('titulo') + file extension for saveAs option?

var path = require('path');

module.exports = {


    var uploadOptions = {
        dirname: sails.config.appPath + '/assets/books',
        saveAs: function(file){
            return req.param('titulo')+path.extname(file.filename);
        maxBytes: 20 * 1000 * 1000

            return res.serverError(err);

    Book.create(req.params.all(),function bookCreated(err,book,next){
        if(err) {
        return res.redirect('/book/books');



I also really want to know if inside folder files would be a good place to download the PDF to show in my interface.


source to share

1 answer

I solved the problem by replacing the saveAs function:

saveAs: function(file){
    return req.param('titulo') + path.extname (file.filename);


with the following:

saveAs: function (__newFileStream, cb) {
    cb(null, req.param('titulo') + path.extname(__newFileStream.filename));




All Articles