File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
upload a file using multer Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ app.use('/public',express.static(path.join(__dirname + 'public')));
3131
3232
3333app . get ( '/' , function ( req , res ) {
34- res . send ( 'hy ') ;
34+ res . render ( 'index ') ;
3535} )
3636
3737app . post ( '/api/upload' , function ( req , res ) {
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ <html lang =" en" >
3+ <head >
4+ <meta charset =" UTF-8" >
5+ <meta name =" viewport" content =" width=device-width, initial-scale=1.0" >
6+ <title >Node-js file upload</title >
7+ <!-- Compiled and minified CSS -->
8+ <link rel =" stylesheet" href =" https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css" >
9+
10+ <!-- Compiled and minified JavaScript -->
11+ <script src =" https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js" ></script >
12+
13+ </head >
14+ <body >
15+ <div class =" container" >
16+ <h1 > file upload</h1 >
17+ <% typeof msg != ' indefined' ? msg : ' ' ;%>
18+ <form action =" /api/upload" method =" POST" >
19+ <div class =" file-field input-field" >
20+ <div class =" btn" >
21+ <span >File</span >
22+ <input type =" file" name =" myImage" >
23+ </div >
24+ <div class =" file-path-wrapper" >
25+ <input class =" file-path validate" type =" text" >
26+ </div >
27+ </div >
28+ <button type =" submit" class =" btn" >Submit!!</button >
29+ </form >
30+ </div >
31+
32+ </body >
33+ </html >
You can’t perform that action at this time.
0 commit comments