瀏覽代碼

文件上传

Shi Kejing 4 年之前
父節點
當前提交
e0854ca605
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlBannerCnotroller.java

+ 5 - 1
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlBannerCnotroller.java

@ -8,6 +8,7 @@ import cn.stylefeng.guns.zjxl.model.ret.BaseResultModel;
import cn.stylefeng.guns.zjxl.model.ret.ResultOneModel;
import cn.stylefeng.guns.zjxl.service.ZjxlBannerService;
import cn.stylefeng.guns.zjxlUtil.BaseController;
import cn.stylefeng.guns.zjxlUtil.FastDFSUtil;
import cn.stylefeng.guns.zjxlUtil.PageUtil;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.node.ObjectNode;
@ -43,6 +44,8 @@ public class ZjxlBannerCnotroller extends BaseController {
    @Autowired
    FastDFSConfig fastDFSConfig;
    @Autowired
    FastDFSUtil fastDFSUtil;
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;
@ -145,7 +148,8 @@ public class ZjxlBannerCnotroller extends BaseController {
        String fileType = fullName.substring(fullName.lastIndexOf(".") + 1).toLowerCase();
        String fileName = fullName.substring(0, fullName.lastIndexOf("."));
        //上传到fastdfs
        ObjectNode objectNode = fastDFSConfig.fastDFSUtil().upload(mf.getInputStream(), fileType, "");
//        ObjectNode objectNode = fastDFSConfig.fastDFSUtil().upload(mf.getInputStream(), fileType, "");
        ObjectNode objectNode = fastDFSUtil.upload(mf.getInputStream(), fileType, "");
        //解析返回的objectNode
        uploadModel.setFileName(fileName);
        uploadModel.setFileType(fileType);