I try to upload a file to my node / express application and I get the following error:
{ [Error: ENOENT, rename '/tmp/64124a9886fdb03f1faee159bc533776'] errno: 34, code: 'ENOENT', path: '/tmp/64124a9886fdb03f1faee159bc533776' } /home/frankie/Projects/LP/routes/manager/deliverables.js:51 throw err; ^ Error: ENOENT, rename '/tmp/64124a9886fdb03f1faee159bc533776'
Here is the relevant code from my application:
if (req.files.file.name !== '' && req.files.file.size !== 0) { // this will move the uploaded file from the tmp folder to the uploads folder fs.rename(req.files.file.path, app.get('loc') + "uploads/" + name + "-" + id + "/" + req.files.file.name, function (err) { if (err) throw err;
When I check what is in / tmp, the file is:
fiega@fiega:/tmp$ ll total 56 drwxrwxrwt 12 root root 4096 Dec 12 11:33 ./ drwxr-xr-x 23 root root 4096 Sep 27 22:54 ../ -rw-rw-r-- 1 fiega fiega 903 Dec 12 11:33 13a26570f87297fd7f61785ef7d8772b
This is how I use the body parser:
app.use(express.cookieParser()); app.use(express.bodyParser()); app.use(express.methodOverride());
Any ideas? I tried changing the permissions of my entire application, but not the cube.
bejm
source share