注意路径:可以从磁盘中找出文件夹具体路径拿出来就可以使用了‘’
代码:
package gaea.ImportService.utils;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.util.ResourceUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.Properties;
public class uploads {
private static final Logger logger = LoggerFactory.getLogger(uploads.class);
public static String logUpload(MultipartFile file) throws Exception {
if (file.isEmpty()) {
return "上传失败,请选择文件";
}
String rootPath = System.ge