I have tried to run function to upload the file to the assets folder in the server. It work on my mac, but when I run it on CentOS 7 server, the error of mkdir permission denied occured.
req.file('avatar').upload({
dirname: require('path').resolve(sails.config.appPath, 'assets/images')
},function (err, uploadedFiles) {
if (err) return res.serverError(err);
return res.json({
message: uploadedFiles.length + ' file(s) uploaded successfully!'
});
});
I have already set the permission folder, as you can see:
drwxrwxrwx. 2 root root 4096 May 6 12:49 assets
and to try execute it from folder app, already tried changing the dirname
line into
dirname: sails.config.appPath + 'assets/images'
but still, the same error of EACCESS permission denied mkdir to the folder /images
persist . Is there any workaround to let sailsjs apps generate a sub folder inside /assets
folder without getting this error?