Commit 44413526 authored by liqin's avatar liqin 💬

Merge branch 'master' of http://111.203.232.171:8888/licc/shop-mall into master

parents 590b1a41 fd02f155
......@@ -42,7 +42,7 @@ public class UploadServiceImpl implements UploadService {
@Autowired
private UsersMapper usersMapper;
@Value("${file.upload.path:#{null}}")
// @Value("${file.upload.path:#{null}}")
private String path;
/**
......@@ -152,10 +152,10 @@ public class UploadServiceImpl implements UploadService {
public List imageUpload(MultipartFile[] files, String zxField, String zxAddress,String inviteCode) {
//获取上传图片数量,打印在控制台
System.out.println("上传图片数量" + files.length);
String zxUrl = new String();
//创建集合
List<Map<String, Object>> root = new ArrayList<Map<String, Object>>();
String fileName1=null;
String zxUrl=null;
// 要上传的目标文件存放的绝对路径
// final String localPath = path;
Long time = new Date().getTime();
......@@ -167,6 +167,7 @@ public class UploadServiceImpl implements UploadService {
if (file.isEmpty()) {
System.out.println("上传图片为空,请重新上传");
}
//判断上传文件格式
String fileType = file.getContentType();
if (fileType.equals("image/jpeg") || fileType.equals("image/png")) {
......@@ -181,6 +182,7 @@ public class UploadServiceImpl implements UploadService {
//设置文件存储路径,可以存放在你想要指定的路径里面
String Path="/opt/upload/video/"; //上传图片存放位置
zxUrl+=localPath+fileName+",";
if (FileUtils.upload(file,Path, fileName)) {
//文件存放的相对路径(一般存放在数据库用于img标签的src)
String relativePath ="用于判断是否图片上传成功,返回值有:"+fileName;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment