配置从公网访问文件,优化图片上传
This commit is contained in:
@@ -11,11 +11,9 @@ import com.onekeycall.videotablet.service.UserService;
|
||||
import com.onekeycall.videotablet.utils.CXAESUtil;
|
||||
import com.onekeycall.videotablet.utils.JwtUtil;
|
||||
import com.onekeycall.videotablet.utils.TextUtils;
|
||||
import org.apache.tomcat.util.http.fileupload.FileUploadException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -30,9 +28,6 @@ import java.util.Map;
|
||||
public class ManageSnController {
|
||||
Logger logger = LoggerFactory.getLogger(ManageSnController.class);
|
||||
|
||||
@Value("${file.upload.path}")
|
||||
private String uploadPath;
|
||||
|
||||
@Autowired
|
||||
private JwtUtil jwtUtil;
|
||||
@Autowired
|
||||
@@ -46,7 +41,9 @@ public class ManageSnController {
|
||||
|
||||
@PostMapping("/tablet/upload_avatar")
|
||||
public Result uploadAvatar(@RequestParam("file") MultipartFile multipartFile) {
|
||||
String avatarPath = uploadPath + File.separator + FilePath.TABLET_PATH + File.separator + FilePath.AVATAR_PATH + File.separator;
|
||||
String projectPath = System.getProperty("user.dir");
|
||||
|
||||
String avatarPath = projectPath + File.separator + FilePath.getAvatarPath();
|
||||
|
||||
File fileDir = new File(avatarPath);
|
||||
if (!fileDir.exists()) {
|
||||
|
||||
Reference in New Issue
Block a user