All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fhs.fileService.action.UMEditAction Maven / Gradle / Ivy

The newest version!
package com.fhs.fileService.action;


import com.fhs.core.config.EConfig;
import com.fhs.core.exception.ParamException;
import com.fhs.fileService.bean.ServiceFile;
import com.fhs.fileService.business.FileServerBusiness;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.util.Arrays;

/**
 * um编辑器图片上传处理
 * by jackwong
 */
@RequestMapping("um")
@Controller
public class UMEditAction {
    @Autowired
    private FileServerBusiness fileServerBusiness;

    /**
     * 上传图片
     * @param upfile 文件
     * @return 文件对象
     */
    @ResponseBody
    @RequestMapping("imageUp")
    public String imageUp(MultipartFile upfile) {
        if (upfile == null ) {
            throw new ParamException("文件不能为空");
        }
        ServiceFile file = fileServerBusiness.uploadFileForList (Arrays.asList (upfile)).get (0);
        String result = "";
        System.out.println(result);
        return result;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy