我想上传一个文件到我的项目相对路径。如果我想将文件保存在项目路径中,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)
我不理解什么应该是正确的道路。
请告诉我正确的做法。
在此先感谢。
惊鼓