my code
initialy i am uploading image to my local public server where code is running using fs mv method then i am giving local path , server path ubuntu, some times it is uploading some times it shoing this error i dont know why please help me on this
try {
await sftp.put(config.localPath + "\\"+newImageName, config.ubuntuServerPath + newImageName).
then((data) => {console.log(data)})
} catch (error) {
console.log(error)
const err = "failed please try again";
cb(newImageName, err)
}
Error: put: Bad path: D:\New folder\FTP\public\image\165.jpg ENOENT: no such file or directory, access 'D:\New folder\FTP\public\image\165.jpg at SftpClient.fmtError (D:\New folder\FTP\node_modules\ssh2-sftp-client\src\index.js:111:22) at SftpClient.put (D:\New folder\FTP\node_modules\ssh2-sftp-client\src\index.js:743:22) at MasterProductServices. (D:\New folder\FTP\src\models\master\masterservice.ts:459:22) at Generator.next () at fulfilled (D:\New folder\FTP\src\models\masterproduct\masterservice.ts:5:58) at processTicksAndRejections (node:internal/process/task_queues:96:5) { code: 'ERR_GENERIC_CLIENT', custom: true }
initialy i am uploading image to my local public server where code is running using fs mv method then i am giving local path , server path ubuntu, some times it is uploading some times it shoing this error i dont know why please help me on this