Skip to content

Commit 018e189

Browse files
committed
form created
1 parent 0c04341 commit 018e189

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

upload a file using multer/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ app.use('/public',express.static(path.join(__dirname + 'public')));
3131

3232

3333
app.get('/',function(req,res){
34-
res.send('hy');
34+
res.render('index');
3535
})
3636

3737
app.post('/api/upload',function(req,res){
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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>

0 commit comments

Comments
 (0)