0
我想在Play 2.0.4中做一个基本的文件上传。文件上传本身起作用,我设法得到一个File
对象。但是,我想将此文件复制到/public/images/
目录中。我怎样才能做到这一点?下面的代码产生任何结果或错误:如何在Play框架中复制上传的文件?
FilePart picture = body.getFile("file");
File file = picture.getFile();
try
{
File dest = new File("../../public/images/new.png");
Logger.debug("Got dest: " + dest.getAbsolutePath());
file.renameTo(dest);
return ok(file.getAbsolutePath());
}
catch (Exception e)
{
e.printStackTrace();
return ok(images.render(false, e.toString()));
}
你有没有知道如何在播放框架中上传多个文件? [请回答我的问题](http://stackoverflow.com/q/18441313/1490530) – 2013-08-26 10:30:13