Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Prohibited file name #3

Open
estellederrien opened this issue May 15, 2020 · 0 comments
Open

Error: Prohibited file name #3

estellederrien opened this issue May 15, 2020 · 0 comments

Comments

@estellederrien
Copy link

estellederrien commented May 15, 2020

Hello Heinrich Fenkart, how are you doing ?

I'm using https://github.com/hnrch02/multer-ftp

I am trying to upload multiples file to an infinity free FTP

This is my code :

   var FTPStorage = require('multer-ftp')
    
    var  storage = new FTPStorage({
        basepath: '/htdocs/files',
        ftp: {
            host: "ftpupload.net",
            user: "epiz_xxxx",
            password: "xxxxxx",
            secure: false
        }
    })

    var uploadFiles = multer({ storage: storage });

  app.post("/createFiles", uploadFiles.array("file", 10), function(req, res, err) {
        if (err) {
            console.log(err);
        }
        var filenames = [];
        req.files.forEach(function(file) {
            filenames.push(file);
        });
        res.send(filenames);
    });

This is the error :

Error: Prohibited file name:
\htdocs\files\f2ad7d0610de98228039ad97b68f0429.jpg

For information, when I save the multiples files on the node server, it works :

  var storageFiles = multer.diskStorage({
        destination: function(req, file, cb) {
            cb(null, "./uploads/files");
        },
        filename: function(req, file, cb) {
            let ext = file.originalname.substring(file.originalname.lastIndexOf("."), file.originalname.length);
            cb(null, file.originalname + "-" + Date.now() + ext);
        }
    });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant