Posted By:
Maruthi_Babu
Posted On:
Friday, October 27, 2006 06:56 AM
Hi All , I am Facing Problem in renaming a file using multipartRequest ,My requirement is The File Should Stored In A specific Folder By Adding the the TimeStamp to its Original Name To Avoid collission .i Used DefaultRenamePolicy But It has The Limitation that if The Same File exists It Will Rename by appending 1,2.. to original name . my code snippet like this FileRenamePolicy renamePolicy=new RenameFile() ; MultipartRequest multi =new MultipartRequest(request,"D:/UploadData",10*1024*1024,"ISO-8859-1",renamePolicy ); //And I override the rename method like this public class RenameFile implements FileRenamePolicy
More>>
Hi All ,
I am Facing Problem in renaming a file using multipartRequest ,My requirement is The File Should Stored In A specific Folder By Adding the the TimeStamp to its Original Name To Avoid collission .i Used DefaultRenamePolicy But It has The Limitation that if The Same File exists It Will Rename by appending 1,2.. to original name .
my code snippet like this
FileRenamePolicy renamePolicy=new RenameFile() ;
MultipartRequest multi =new MultipartRequest(request,"D:/UploadData",10*1024*1024,"ISO-8859-1",renamePolicy );
//And I override the rename method like this
public class RenameFile implements FileRenamePolicy
{
public java.io.File rename(java.io.File oldfile)
{
String new_name="newfile.csv";
File newfile= new File(new_name);
boolean Rename = oldfile.renameTo(newfile);
return oldfile;
}
But i am not geetting renamed file
<<Less