java - 文件上传后我希望把文件保存在我自己创建的一个文件夹中
PHPz
PHPz 2017-04-18 09:18:09
0
1
293
File fileSourcePath = new File("resources/upload/");
File fileSource = new File(fileSourcePath, mulFileSource.getOriginalFilename());
if (!fileSourcePath.exists()) {
    fileSourcePath.mkdirs();
}
// 将接收得图片暂存到临时文件中
mulFileSource.transferTo(fileSource);

我想把上传的文件保存在upload文件夹中,怎么写路径。这样写会报
java.io.FileNotFoundException错误

PHPz
PHPz

学习是最好的投资!

reply all(1)
大家讲道理

What the hell is the picture you uploaded?

If you run it in eclipse, it should be a relative path with the project directory as the root, such as src/main/resources/upload/

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template