vue项目实现form带参数的提交文件请求

为了实现让每个用户上传的文件保存在独立对应的文件夹之内,

前端必须给参数,参数是用户名

html代码部分如下

    <form id="formSubmit" method="post" 

    action="/api/MINDS/UploadServlet?name=" 

    enctype="multipart/form-data">

    <input id="chooseInput" type="file" name="uploadFile" />
    <input id="submitBtn" type="submit" value="提交" />

</form>

js部分

document.getElementById('formSubmit').action+=this.name;

猜你喜欢

转载自blog.csdn.net/qq_37828633/article/details/80826439