File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed
java-ai/src/main/java/oracleai Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change 14
14
import java .nio .file .Path ;
15
15
import java .nio .file .Paths ;
16
16
17
- import org .apache .commons .io .FileUtils ;
18
17
import org .springframework .http .MediaType ;
19
18
20
19
@ Controller
@@ -50,7 +49,7 @@ public ResponseEntity<String> uploadImage(@RequestParam("image") MultipartFile f
50
49
}
51
50
52
51
try {
53
- FileUtils .forceMkdir (new File (DIRECTORY ));
52
+ org . apache . commons . io . FileUtils .forceMkdir (new File (DIRECTORY ));
54
53
Path path = Paths .get (DIRECTORY + file .getOriginalFilename ());
55
54
file .transferTo (path );
56
55
@@ -64,7 +63,7 @@ public ResponseEntity<String> uploadImage(@RequestParam("image") MultipartFile f
64
63
public ResponseEntity <byte []> getImage (@ PathVariable String filename ) throws IOException {
65
64
try {
66
65
File file = new File (DIRECTORY , filename );
67
- byte [] fileContent = FileUtils .readFileToByteArray (file );
66
+ byte [] fileContent = org . apache . commons . io . FileUtils .readFileToByteArray (file );
68
67
return ResponseEntity .ok ().contentType (MediaType .IMAGE_JPEG ).body (fileContent );
69
68
} catch (IOException e ) {
70
69
return ResponseEntity .notFound ().build ();
You can’t perform that action at this time.
0 commit comments