如何直接使用Spring绑定blob图像的文件类型


                            private Blob image;
                            public Blob getImage() {
                             return image;
                                }
                             public void setImage(Blob image) {
                             this.image = image;
                              }

这是blob图像对象

                                                    <label class="col-md-4                                        control-label" for="file">
                                Upload Image:</label>
                            <div class="col-md-8">
                                <sf:input id="file" name="file"
                                     type="file" placeholder="" path="file"
                                    class="form-control input-md" />

这是jsp页面

                    @RequestMapping(value = "/changeImage", method = RequestMethod.POST)
public String getChangeImage() {


    return "Editprofile";
}

这是控制器方法。在这种方法中,我想获得上传文件并将其转换为Blob图像。有办法吗?

 $scope.upload = function() {
  var f = document.getElementById('file').files[0], r = new FileReader();
      r.onloadend = function(e) {
      var data = e.target.result;
        }
      r.readAsBinaryString(f);

最新更新