0
String oldName = D:\careers.bstalents.com\build\web\uploads\Resume\old.doc;
String newName = D:\careers.bstalents.com\build\web\uploads\Resume\new.doc;
File newFile = new File(newName);
File oldFile = new File(oldName);
boolean rename = oldFile.renameTo(newFile);
if (rename) {
outs.write(formFile.getFileData());
outs.close();*/
FileOutputStream fileOutStream = new FileOutputStream(newFile);
fileOutStream.write(resume.getFileData());
fileOutStream.flush();
fileOutStream.close();
}
我发布了上面的代码,请分享您的意见。这里renameTo()方法无法做到这一点。是否在代码中存在任何问题?如何在java中使用新名称重命名简历(.doc)
将ü把你做了什么错误,因为它的工作对我很好.. –
当我打印重命名控制台它返回假,如果重命名= false,那么它不会去在if block中,所以我不能在新文件中写入内容。 –
也许你的old.doc仍然被其他程序打开? –