|
@@ -5,9 +5,10 @@ import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.facade.UploadFacade;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -20,12 +21,12 @@ public class UploadController {
|
|
|
@Autowired
|
|
|
private UploadFacade uploadFacade;
|
|
|
|
|
|
- @PostMapping("/uploadImage")
|
|
|
+ @CrossOrigin(allowCredentials = "true", allowedHeaders = "*", methods = { RequestMethod.POST }, origins = "*")
|
|
|
+ @PostMapping(value = "/uploadImage", produces = "application/json;charset=UTF-8")
|
|
|
public RespDTO<FileDTO> singleFileUpload(@RequestParam("upfile") MultipartFile file) {
|
|
|
return RespDTO.onSuc(uploadFacade.singleFileUpload(file));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@PostMapping("/deleteRemoteFile")
|
|
|
public RespDTO<Boolean> deleteRemoteFile(@RequestParam("path") String path) {
|
|
|
return RespDTO.onSuc(uploadFacade.deleteRemoteFile(path));
|