search

Home  >  Q&A  >  body text

javascript - Express how to upload files and transmit strings at the same time?

<form class="" method="post" action="/web/project/<%=projectName%>/importFile">

    <p class="form-group">
        <label>选择文件</label>
        <input class="form-control" type="file" name="file"/>
    </p>
    <p class="form-group">
        <label>数据格式</label>
        <select id="ext-select" class="form-control" name="ext">
            <option value="csv" default>csv</option>
            <option value="json">json</option>
            <option value="js">js</option>
            <option value="xml">xml</option>
            <option value="txt">txt(文本格式,目前用于pc端)</option>
        </select>
    </p>

File upload requires enctype="multipart/form-data", but the body-parser in express4 does not recognize the data submitted by enctype="multipart/form-data", but if you cancel this, the file cannot be uploaded, what should I do

怪我咯怪我咯2688 days ago544

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-07-05 10:41:05

    Change a plug-in, such as multiparty, and check the documentation for usage after the installation is complete

    reply
    0
  • Cancelreply