Open alexhans1 opened 7 years ago
Okay after trying a few things out, I found that (at least on Windows) the line: path.join(opts.basepath, raw.toString('hex') + path.extname(file.originalname))) tuns slashes in backslashes.
My fix:
String.prototype.replaceAll = function(target, replacement) {
return this.split(target).join(replacement);
};
function getDestination (req, file, opts, cb) {
random(16).then(function(raw) {
cb(null, path.join(opts.basepath, raw.toString('hex') + path.extname(file.originalname)).replaceAll("\\", "/"))
}, cb)
}
Hi,
I didn't understand, where did you put the above code.
Hey Folks,
I stumbled upon an issue while uploading file to my ftp location.
I'm using the following as my basepath: basepath: '/public_html/BDUDBdev/userpics/',
However the file is uploaded to the base directory of my ftp server as \public_html\BDUDBdev\userpics\b1bf9a988e8748792895d99c4816786f.png instead of to the given directory.
Anyone know what to do?