Questions tagged [multer]

Multer is a node.js component used to handle multipart/form-data uploads.

Multer is a middleware for handling multipart/form-data, which is primarily used for uploading files. It is written on top of for maximum efficiency.

Multer will not process any form which is not multipart (multipart/form-data).

Github repo expressjs/multer.

Github repo busboy

3186 questions
220
votes
14 answers

Node Multer unexpected field

I'm working on uploading a file to my app using the multer npm module. The multer function I have defined is to allow a single file uploaded to the file system. Everything works during run time; the issue is after I upload the file I get an error…
Sethe23
  • 2,552
  • 4
  • 18
  • 18
137
votes
6 answers

How to find the size of the file in Node.js?

I am using multer for uploading my images and documents but this time I want to restrict uploading if the size of the image is >2mb. How can I find the size of the file of the document? So far I tried as below but not working. var storage =…
Daniel
  • 1,939
  • 3
  • 11
  • 18
82
votes
18 answers

How to store a file with file extension with multer?

Managed to store my files in a folder but they store without the file extension. Does any one know how would I store the file with file extension?
user3355603
  • 1,091
  • 2
  • 12
  • 19
54
votes
8 answers

express (using multer) Error: Multipart: Boundary not found, request sent by POSTMAN

Notice: only when I use form-data body form in Postman (which is the form I have to use because I want to send files beside text fields), I get: Error: Multipart: Boundary not found. when I use x-www-form-urlencoded everything is ok. (ofcourse…
user9150719
44
votes
3 answers

How to limit the file size when uploading with multer?

I'm making a simple file upload system with multer: var maxSize = 1 * 1000 * 1000; var storage = multer.diskStorage({ destination: function (req, file, callback) { callback(null, 'public/upload'); }, filename: function (req, file,…
Merijn de Klerk
  • 953
  • 2
  • 11
  • 21
43
votes
7 answers

Cannot app.use(multer). "requires middleware function" error

I'm just starting learning NodeJS and I am stuck with a problem. I would like to upload files to my server. To do so I searched and found out this module multer. Doing as the example on GitHub works: var express = require('express'); var multer =…
João Menighin
  • 3,083
  • 6
  • 38
  • 80
42
votes
28 answers

ENOENT: no such file or directory .?

This is error which am getting while post data and file. I have followed 'academind' tutorial for building Restful API services, also i have been searching answer for this type of errors but nothing works for me. Am using "multer" to upload file…
codedamn
  • 811
  • 4
  • 10
  • 16
40
votes
8 answers

Uploading image to amazon s3 using multer-s3 nodejs

I am trying to upload an image to amazon s3 using multer-s3, but I am getting this error: TypeError: Expected opts.s3 to be object node_modules/multer-s3/index.js:69:20 This is my server code: var upload = multer({ storage: s3({ …
mBlaze
  • 401
  • 1
  • 5
  • 7
40
votes
6 answers

Node.js, multer and req.body empty

Here it is my problem, I have a form where I can insert a file and a field but I receive only the file and not the parameter test! Why? This is my code: app.js: var express = require('express'); var bodyParser = require('body-parser'); var app =…
Filippo1980
  • 2,745
  • 5
  • 30
  • 44
38
votes
7 answers

Uploading multiple files with multer, but from different fields?

How can I have multer accept files from multiple file type fields? I have the following code that uploads a single file, using multer in node.js: var storage = multer.diskStorage({ destination: function (req, file, callback) { callback(null,…
Andre M
  • 6,649
  • 7
  • 52
  • 93
37
votes
6 answers

Node/Multer Get Filename

I am using the following to upload files to a directory via Multer. It works great, but I need to perform some actions after upload that require the name of the file I just posted to the "upload" directory. How do I get the name of the file I just…
Kode
  • 3,073
  • 18
  • 74
  • 140
37
votes
1 answer

Node JS AWS S3 file upload. How to get public URL response

I'm uploading a file to Amazon S3 using the Node SDK. The file uploads are working fine, but I want to get the public url of the file to send back to the client. At the moment the response I get is: Successfully uploaded data { ETag:…
Jack Wild
  • 2,072
  • 6
  • 27
  • 39
27
votes
3 answers

Multer create new folder with data

I use multer. Question 1 When I put the following snippet in the app.js app.use(multer({ dest: './uploads' } ).single('file')); it creates a new folder under the root folder, my question is about this new folder's lifeCycle, When it'll…
user4209821
24
votes
1 answer

Node Multer memory storage: how to release memory

Ok multer supports memory storage, this is great. but how to release the memory after uploading the file pls ? storage = multer.memoryStorage(); upload = multer({ storage : storage }).single('image'); For disk storage, I can delete the file in the…
user3552178
  • 2,719
  • 8
  • 40
  • 67
24
votes
11 answers

multer - req.file always undefined

I've looked at a lot of answer for this same question, but I haven't found a working solution yet. I am trying to make a web app that you can upload files to using express and multer, and I am having a problem that no files are being uploaded and…
mlamp
  • 773
  • 2
  • 9
  • 21
1
2 3
99 100