input type="file"文件上传到后台读取

input type="file"文件上传到后台读取

html页面(表单采用bootStrap)

js部分:

//更换头像时把上传的图片post方式到控制器 

表单部分

class="col-xs-12 col-sm-4 text-center">
    class="list-group">
  • class="list-group-item text-left"> class="entypo-user">  个人资料
  • class="list-group-item text-center"> src="${ user.avatar}" alt="" class="img-circle img-responsive img-profile">
  • class="list-group-item text-right" style="text-align: center">
    id="drag-and-drop-zone" class="uploader">
    action="" method="post" enctype="multipart/form-data"> class="btn btn-success btn-file"> 更换头像 class="glyphicon glyphicon-picture" aria-hidden="true"> type="file" name="fileField" class="file" id="fileField" size="28" οnchange="upload()"/>

控制器部分:

@RequestMapping("editProfile") public ModelAndView editProfile(HttpServletRequest request,@CurrentUser User usaer){     String file=request.getParameter("file");  ModelAndView mv=new ModelAndView();     return mv; }
posted on 2018-08-02 18:42  笨小孩做开发 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/dullbaby/p/9409158.html

你可能感兴趣的:(java,后端,javascript)