찾다

 >  Q&A  >  본문

node.js - 用connect-multer上传文件,form中的req.body.photo.name不能访问

    <html>
    <head>
       <title><%= title %></title>
        <link rel="stylesheet" href="/stylesheets/style.css" />
    </head>
        <body>
        <h1><%= title%></h1>
        <p>Upload a photo to your account below.</p>
        <form method="post" enctype="multipart/form-data" >
        <p><input type="text",name="photo[name]",placeholder="Name" /></p>
        <p><input type="file", name="photo[image]" /></p>
        <p><input type="submit", value="Upload" /></p>
        </form>
        </body>
    </html>
    app.use(logger('dev'));
    app.use(bodyParser.json());
    app.use(bodyParser.urlencoded({ extended: false }));
    app.use(cookieParser());
    app.use(express.static(path.join(__dirname, 'public')));
    app.use(multipart());

用的是connect-multipart处理的上传,req.body.photo字段却找不到

迷茫迷茫2768일 전598

모든 응답(0)나는 대답할 것이다

답장 없음
  • 취소회신하다