cari

Rumah  >  Soal Jawab  >  teks badan

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字段却找不到

迷茫迷茫2767 hari yang lalu596

membalas semua(0)saya akan balas

Tiada jawapan
  • Batalbalas