我如何获得node.js中的“name”属性
<input type='file' name='upload1'/>
当这个表单被提交时,我怎么能得到node.js上的“name”属性(upload1) 我使用restify,并上传图像。
node.js中的正确方法是使用像express这样的web应用程序框架。 它给你更多的select以及灵活性。 在快递中您可以这样做:
var express = require('express'); //Initialize express var app = express(); app.listen(3000); app.use(express.bodyParser()); //to parse the forms app.post('/pagesubmit', function(request, response){ //to handle POST to the page console.log(request.body.username); //tp access input text 'username' console.log(request.files.name); //to access input file 'name' });
只需使用节点强大的file upload。
- 如何包含明确键入Angular 2项目中的文件
- 套接字挂起与nodejs的错误
- 在NodeJS上为Access-Control-Allow-Origin设置标题
- nodejitsu 400错误:ENOENT,打开'/opt/run/snapshot/package/images/tmp/72118-89rld0.png
- 安装完成后重新安装Ember CLI崩溃 – 我在做什么错?
- mongoose如何查询多个文档,如果没有find,保存并返回ID?
- Express.js – Helmet.js和其他中间件,以及安装的应用程序?
- 如何从socket.io获取本地事件的数组?
- 如何在公共事件属性上join两个事件stream?