How To Properly Handle Files Upload Using Node.js Express Backend?
I decided to use ng-flow, an Angular implementation of flow.js at front end to handle files uploading, I then picked multer as middleware to receive the files. I did the most simpl
Solution 1:
Actually everything is being saved at my server, under /temp_uploads as it's supposed to. But files won't keep their names and not even extension. I wonder what I should do to configure it all good and even prevent problems at my server.
You can get control over naming by following the example at multer README.md. I've included it below:
app.use(multer({
dest: './uploads/',
rename: function (fieldname, filename) {
return filename.replace(/\W+/g, '-').toLowerCase() + Date.now()
}
}))
Looks like there are many other hooks as well.
See also cloud-storage module. You can use that to push data to Google.
abstract-blob-store and google-cloud-storage built on top of that would be even better fit. It would allow you to stream the files directly to Google without having to use an intermediate storage.
Post a Comment for "How To Properly Handle Files Upload Using Node.js Express Backend?"