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
"errno":-4058,"code":"ENOENT","syscall":"open" #33
Comments
Hey @Umesh2Patel can you show me what headers you're sending? Trying to replicate this on my end. Thanks! |
@Umesh2Patel any word? Trying to get more information on what kind of headers you're sending so I can replicate this issue on my end. |
@richardgirges Thanks for following up. After changing my code I am not seeing the error anymore. app.post('/deletefiles', function(req, res) { |
In my case, it turned out that I haven't created the folder If you encounter this, try const file = req.files.file
const fileName = req.files.file.name
const path = 'uploads/' + fileName
file.mv(path, function(err) {
if (err) return res.status(500).send(err);
res.send('File uploaded!');
}); |
Hi, I am using sampleFile.mv. It was working before but recently I am seeing below exception. I am using Postman tool to make a call. I tried using RestClient tool and seeing same error.
Response:
{
"errno": -4058,
"code": "ENOENT",
"syscall": "open",
"path": "C:\Users\QATools\testdb-api\Users\u000bn0u7yzDesktopOmniture excels files - Copy\omniture-test-data.xlsx"
}
Below is the code i am using:-
var express = require('express')
const fileUpload = require('express-fileupload');
app.post('/uploadfile', function(req, res) {
if (!req.files)
return res.status(400).send('No files were uploaded.');
// The name of the input field (i.e. "sampleFile") is used to retrieve the uploaded file
let sampleFile = req.files.file;
console.log(req.files.file);
var filename = req.files.file['name'];
console.log(filename);
// Use the mv() method to place the file somewhere on your server
sampleFile.mv('C:\Users\user\Desktop\Omniture excels files - Copy/'+filename, function(err) {
if (err)
return res.status(500).send(err);
});
});
The text was updated successfully, but these errors were encountered: