我想上傳一個文件到我的項目相對路徑。如果我想將文件保存在項目路徑中,CommonsMultipartFile的文件上傳路徑應該是什麼?
webapp/fileUpload /是我希望文件上傳的路徑。
所以當我把它給了我
java.io.FileNotFoundException: http:\localhost:8080\SpringDemo\fileUpload\design.txt(The filename, directory name, or volume label syntax is incorrect)
我不理解什麼應該是正確的道路的路徑
CommonsMultipartFile commonsFile = user.getImage();
String fileName = commonsFile.getOriginalFilename();
File destFile = new File("http://localhost:8080/SpringDemo/fileUpload/",fileName);
。
I want to save it under my project folder and not on any other path so I am using http:\localhost:8080\SpringDemo\fileUpload\as the path.
When i paste http://localhost:8080/SpringDemo/fileUpload/abc.txt into my browser it shows me the file.(abc.txt)
我不理解什麼應該是正確的道路。
請告訴我正確的做法。
在此先感謝。
驚鼓