form设置enctype=multipart/form-data后,input怎么获得value
发布于 11 年前 作者 i-1213 11295 次预览 最后一次回复是 11 年前 来自 问答
<form action="/product/create" method=“post” enctype=‘multipart/form-data’> <div class=“form-group”> <label for=“file”>图片</label> <input type=“file” id=“file” name="file"multiple=“multiple” accept=“image/*”> </div> <div class=“form-group”> <label for=“content”>描述</label> <textarea class=“form-control” id=“content” rows=“4” name=“content” ></textarea> </div> <button type=“submit” class=“btn btn-primary”>保存</button> </form>
怎样在上传图片的时候获取textarea的值?
3 回复
我看你骨骼惊奇,送你一套STREAM顺解JS。
@MiguelValentine streamdo的 data应该传什么参数?
@i-1213
然后 req.postarr 是传的 VALUE req.files是文件的文件名和buffer。 再通过FS模块对文件的buffer进行读写等等。