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图像。有什么办法吗?
答案 0 :(得分:0)
$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);