【发布时间】:2012-01-10 16:48:27
【问题描述】:
我现在正在使用play框架,我已经知道我们可以在application.conf中指定附件路径:
# Store path for Blob content
attachments.path=data/attachments
我的应用程序有不同种类的图片,我需要将这些图片分成不同的目录。
如何实现我的想法?
非常感谢!
这是我的控制器代码:
public static void uploadAvatar(Blob file){
if(request.isNew){
Long userId = Long.parseLong(session.get(Constants.USER_ID_IN_SESSION));
User user = User.findById(userId);
// Delete old picture
if (user.avatar.getFile() != null) {
user.avatar.getFile().delete();
}
user.avatar = file;
user.avatarFileName = file.getFile().getName();
user.save();
}
Users.settings();
}
【问题讨论】:
标签: java playframework