`
j_will
  • 浏览: 11710 次
社区版块
存档分类
最新评论

KindEditor图片上传

 
阅读更多
1返回Json的信息:

//成功时 { "error" : 0, "url" : "http://www.example.com/path/to/file.ext" }

//失败时 { "error" : 1, "message" : "错误信息" }
后台代码:
@RequestMapping(value = "uoload")
    @ResponseBody
    public String uoload(HttpServletRequest request,HttpServletResponse response,
                         @RequestParam MultipartFile imgFile) throws Exception {

        //String savePath = request.getRealPath("/") + "attached/";
        String savePath = FastDFSUtil.upload(imgFile.getBytes(), "gif");

        return "{ \"error\" : 0, \"url\" : \""+urlPrefix+savePath+"\" }";
    }
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics