can we stop changing the way multer setup please ? im banging my head
See original GitHub issueThis used to work inside a route now it is no longer working
var handler = multer({
dest: __base + 'uploads/images/',
onFileUploadStart: function (file) {
// You now have access to req
console.dir(req);
console.log(file.fieldname + ' is starting ...')
},
onFileUploadComplete: function (file) {
console.log(file.fieldname + ' uploaded to ' + file.path)
var asset = new Asset();
asset.path = req.files.file ? req.files.file.path.replace('uploads','') : '';
asset.type = req.params.type;
asset.base64_data = req.body.base64_data ? req.body.base64_data : '';
asset.save(function(err, asset_data) {
if (err)
res.send(err);
res.json({ message: 'Asset created!', asset_data: asset_data });
});
}
});
handler(req, res);
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Express multer middleware
Multer is a node.js middleware for handling multipart/form-data , which is primarily used ... NOTE: Multer will not process any form which is...
Read more >Nodejs Express 4 Multer | Stop file upload if user not ...
Express is configured to use passport as auth middelware, but I cannot find a way to prevent file upload if the user is...
Read more >How to use Node.js, Express.js and Multer Restful API for ...
A short step by step tutorial on Restful API for Image Uploader using Node.js, Express.js, and Multer. We are using the form multipart/form-data...
Read more >How to upload file using Multer in Express.js
I am sure you have wondered how to upload files in your Node.js application. ... 1) Install express and multer, and create your...
Read more >All Stories - The Provincetown Independent
I'm the one who's supposed to be asking questions as part of my ongoing ... EASTHAM — A new road is being cut...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
TLDR; read the new readme for the new major version changes in multer (which are very minor) and learn the semver major version meaning.
The point behind having major version number changes is that it is not backwards compatible if you wish to use the older version we are not stopping you. But there are significant benefits to upgrading including that I by myself can not DoS your server by filling your hard drive in (your available hard drive space/your internet speed). As such these changes need a different API which you will need to learn, if you are not willing to learn new APIs when they change I can not help you. In essence you basically are trying to tell use to stop updating multer by telling us to not change anything.
You were actually using
DiskStorage
all along 😃is a shorthand for
Ahh, I understand. It really refers to the
filename
parameter to thediskStorage
function. Should probably clarify that.