Closed arosca closed 6 years ago
You can add an end
eventListener to the upload middleware, like so:
upload.on("end", function(fileinfo){
// do stuff here
})
Look at the More sophisticated example - Events section in the README for all of the events available as well as what information does fileinfo
include
I checked the Moving uploaded files out of uploadDir section.
They use a req.filemanager.move
method, shouldn't i use that? I am not sure on the syntax and how to structure the code.
I use
upload.on("end", function(fileinfo){
var filemanager = upload.fileManager({
targetDir: "./../apps/" + app.get('owner') + "/images",
targetUrl: "/apps/" + fileInfo.sessionID + "/images"
});
filemanager.move(fileInfo.name, "", function(err, result) {
console.dir(result);
})
owner is set in the app.use and the sessionID is set in the template.
I managed to setup the middleware with express.js 4.0 but am having difficulties moving uploaded files out of the public directory.
Here's my upload script:
Uploading a Chicken.jpg file i get the following structure:
I only want to move the "original file". Can anyone please advise?
Thank you!