[node] About multer Middleware. . .

  node.js, question
  • Using express Framework and multer Middleware to Handle File Upload

  • After the route is written, post a file to the server

  • However, the server returned 500. Why did it refuse to handle it?

Here is the code:

  • Routing controlled:

 var multer=require('multer');
 var setMul=multer({dest:'./public/demo'});

In addition: My express here is not version 4.0 yet. . . How to upgrade it to 4.0? Ask the great god for an answer. . .

  • Demo.ejs:

 <form method="post" action="http://localhost:3000/addDemo" enctype="multipart/form-data">
 <input type="text" name="name"/>
 <input type="file" name="files1"/>
 < input type="submit" value= "submit"/>

Is it all right to be fair and square?

  • This is a screenshot of the console:


Why is this 500 yards? Fan, please ask the great god to answer. . .

IfexpressIt’s not up to four yet, so the upgrade can be like this.

npm install --save-dev express@4.14.0

Forced installation4.14.0.

As for your List of HTTP status codes, look at the log