후 나는 다른 폴더 (같은 디스크)로 이동하려고하고 난 창문과 사용에 THIE 오류를Node.js를 fs.rename() 오류 ENOENT
{[Error:ENOENT,rename 'F\myproject\1b231234nsdifhoi2323']
errno:34,
code:ENOENT,
path:'F\\myproject\\1b231234nsdifhoi2323'
}
오전있어
app.use(express.bodyParser({
uploadDir:'./Temp'
}));
여기에 내 이름 바꾸기 코드
내가 경로가 잘못 것 같습니다exports.upload = function(req, res,next){
console.log(req.body);
console.log(req.files);
var tmp_path = req.files.product_video.path;
var target_path = '\\Video\\' + req.files.product_video.name;
console.log(tmp_path); // Temp\1b231234nsdifhoi2323
console.log(target_path); // \Video\name
fs.rename(tmp_path, target_path, function(err) {
if (err) {
console.log(err)
};
fs.unlink(tmp_path, function() {
if (err){
console.log(err)
}else{
res.send('File uploaded to: ' + target_path + ' - ' + req.files.product_video.size + ' bytes');
}
});
});
};
입니다,하지만 난 그것을 알아낼 수 없습니다!
Windows 사용자입니까? 그렇다면'F :'경로명의 드라이브 부분에 콜론 (':')을 포함시켜야합니다. –
하지만 Temp 및 Video 폴더는 동일한 디스크 – paynestrike
에 있습니다. var target_path = 'F : \\ myproject \\ Video \\'+ req.files.product_video.name; it works thanx – paynestrike