Files are uploading as 'file' without its extension
See original GitHub issueHi,
i am using multer to upload my images. Uploading works fine but the problem is all my files are uploading with ‘file’ filetype ie, without its extension. can anyone tell me why…?
My Code:
var uploadProfileImgs = multer({dest : './files/uploads/profile/'}).single('avatar');
app.post('/profile', function (req, res) {
uploadProfileImgs(req, res, function (err) {
if (err) {
console.log(err.message);
// An error occurred when uploading
return
}
console.log('Everything went fine');
// Everything went fine
})
})
My files looks like below:
Issue Analytics
- State:
- Created 8 years ago
- Comments:40 (14 by maintainers)
Top Results From Across the Web
How To Open a File With No Extension
You should first confirm if your file actually has no extension, or you just don't have the program needed to open a particular...
Read more >Is it safe to accept a file upload without any file extension?
The extension itself should not matter. It would be good to figure out the MIME type to know about the content instead.
Read more >How to open file with no extension in Windows 11/10
After uploading the file, click on the Check File Type button. A new tab will open, where the extension of the uploaded file...
Read more >Forums - How to accept uploading files WITHOUT extension?
You're not getting the problem. I'm trying to deal with files WITHOUT any extension. I think that your code is changing the name...
Read more >How to Change the Allowed File Types in the File Upload ...
The default file extensions that Jotform accepts are:... ... The uploaded files are not attaching to the email that I receive.
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
my workaround:
As @gabeio said this is the default behaviour from version
1.0.0
and forward.@ricardomoura You can supply destination as a string if you want to. And if you don’t want to include the mime library you could look at the extension of the original file using the builtin module
path
.Attention Lookout when doing this thought as the client can send any file extension that they want, regardless of what the file actually contains. A rule of thumb is to never trust any data from the client.