Multer.any() not working ?
I have a server to which I wish to upload a file but without checking the input fieldname. I using typescript so formdata isn't really an option at the moment. I tought simply changing my upload.single('picture') to upload.any() should fix it, but if I add a console.log in the destination: of my upload it never shows ( doesn't get there ). Why is this happening when trying to use multer.any? Also if you know of any workarounds to upload files from typescript without refreshing the page it would be great!
single names the file req.file and any names it req.files (note the extra s), could that be it?
@LinusU If I try to use either req.file or req.files it says they are not defined ( typescript error when compiling )
Hmm, does it work with .single? What definition file are you using?
Same thing. I'm trying to avoid setting the filename, but when i use Multer({ ... }).any() I get back an error saying any is not a function. When i set the express middleware of post to .any without the function call, I get back that [object Undefined] is not a function.
@funkjunky I don't think that you have the same thing since @roby2001 has a problem when compiling his typescript, not when running javascript. In your case, it seems like you are using an old version of multer, can you confirm that you are running version 1.1.0 which introduced the .any() function?
I'm not. Sorry about the troubles. I'm using single and it's working fine and dandy now. Super late night programming is dangerous =P Feel free to delete all of my posts on this thread.
Hehe, no problem, we've all been there :)
I managed to get my things working with .single . However typescript doesn't allow you to access req.file / req.files since they don't actually exist before multer. You should talk to the typescript complier guys.
Hmm, yeah I wonder how that works... Oh well, at least this should be closed since the issue is with TypeScript...