我想将文件上传到我的项目相对路径中。
webapp/fileUpload/ 是我希望文件上传的路径。
所以当我给出路径时
CommonsMultipartFile commonsFile = user.getImage();
String fileName = commonsFile.getOriginalFilename();
File destFile = new File("http://localhost:8080/SpringDemo/fileUpload/",fileName);
它给了我
java.io.FileNotFoundException: http:\localhost:8080\SpringDemo\fileUpload\design.txt(The filename, directory name, or volume label syntax is incorrect)
我不明白什么应该是正确的道路。
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)
我不明白什么应该是正确的道路。
请建议我正确的方法来做到这一点。
提前致谢。
津戈