【发布时间】:2016-10-29 21:11:47
【问题描述】:
尝试将图像直接保存在项目路径中。图像直接从基于 Angularjs 构建的 UI 上传。我想将图像保存到 Eclipse 项目中的文件夹中,但它抛出异常。我正在使用spring框架的MutipartFile接口
项目结构
web
|
src
|
main
|
webapp
|
app
|
images
代码
@RequestMapping(path = "/attachmentPath", method = RequestMethod.POST)
public Response attachmentPath(Attachment attachment , @RequestParam(value = "file") MultipartFile file) throws IllegalStateException, IOException {
String orgName = file.getOriginalFilename();
String filePath = "/images/"+orgName;
File dest = new File(filePath);
try { file.transferTo(dest); }
catch (IllegalStateException e)
{ e.printStackTrace();}
例外
java.io.FileNotFoundException: img\images\users\TestCopy1.jpg (The system cannot find the path specified)
【问题讨论】:
-
哪个例外?提供堆栈跟踪?
-
@javaguy - 现已添加
标签: java angularjs eclipse spring