hendisantika / spring-boot-file-upload-example

Spring Boot file upload example
9 stars 9 forks source link

NoSuchFileException upon execution. #1

Closed SonamGadkari closed 5 years ago

SonamGadkari commented 5 years ago

Hi hendisantika,

When I execute the project , I am facing an exception saying java.nio.file.NoSuchFileException: \tmp\WIN_20190920_10_41_45_Pro.jpg I have tried all the possible ways I could (for example changing the folder names) ,but I am ending up with the same exception every time. Any possible solution to this problem is really appreciated.

This is the same error even when I change the folder name to project specific path. java.io.FileNotFoundException: \src\resources\static\images\1.PNG (The system cannot find the path specified)

Thank you,

hendisantika commented 5 years ago

What is your OS @SonamGadkari ??? Let me check again.

SonamGadkari commented 5 years ago

Windows

hendisantika commented 5 years ago

OK. I will fixed later for Windows.

Mean while, Could You try following repo: https://github.com/hendisantika/spring-boot-file-upload-ajax-rest https://github.com/hendisantika/springboot-upload-files-demo https://github.com/hendisantika/Kotlin-Spring-Boot-Upload-Download-Image https://github.com/hendisantika/spring-boot-upload-download-file-rest-api-example https://github.com/hendisantika/springboot-upload-files https://github.com/hendisantika/spring-boot-angular-fileupload https://github.com/hendisantika/File-Upload-Download-API https://github.com/hendisantika/springboot-upload-multiple-file-to-mysql

hendisantika commented 5 years ago

Change

private static String UPLOADED_FOLDER = "/tmp/";

with this

private static String UPLOADED_FOLDER = System.getProperty("java.io.tmpdir");
SonamGadkari commented 5 years ago

Thanks hendisantika. System.getProperty() worked for me. I am able to upload the image to temp folder. Any suggestions if I have to upload the image to project specific path \altarguild\src\resources\static\images\1.PNG

hendisantika commented 5 years ago

Check my other repository above @SonamGadkari. So, Can I say case closed???

SonamGadkari commented 5 years ago

Sure.Thanks