Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ http.createServer(function(req, res){
if(fs.existsSync(filePath)){
res.write(fs.readFileSync(filePath));
} else {
res.write("<h1><a href='http://barretlee.com/'>小胡子哥</a>告诉你:404了~</h1>");
res.writeHead(200, {"Content-Type": "text/html; charset=utf-8"});
res.write("<h1><a href='http://barretlee.com/'>小胡子哥</a>告诉你:404了~</h1>", 'utf-8');
}
res.end();
} else {
res.write("<h1><a href='http://barretlee.com/'>小胡子哥</a>告诉你:404了~</h1>");
res.writeHead(200, {"Content-Type": "text/html; charset=utf-8"});
res.write("<h1><a href='http://barretlee.com/'>小胡子哥</a>告诉你:404了~</h1>", 'utf-8');
res.end();
}
}).listen(PORT, function(){
console.log('Listen at http://0.0.0.0:' + PORT);
});
});
1 change: 1 addition & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>

<meta charset="UTF-8">
<form method="post" action="http://0.0.0.0:3300/img" enctype="multipart/form-data">
<input type="file" name="img" />
<input type="submit" value="提交" />
Expand Down