[Hi! I am using com.oreilly.servlet.MultipartRequest up = new com.oreilly.servlet.MultipartRequest(request,"c:/test",10*1024)
to upload a file into server.Can anyone help me in solving the prevention of overwriting of existing uploaded file?
For example if i upload "paint.bmp",then this will be stored as "paint.bmp" in the server.
Again if i upload a different picture under the same file name "paint.bmp" , the previous one is overwritten by the new one.This shouldnt happen.If the file "paint.bmp" already exists, some new filename should be generated for the new uploaded file and saved.can any one pass me source code for this problem.Thank you in advance...
Did you try using the exists() method of the File object? e.g.:
String pathname = "c:/test";
// I guess you meant "c: est"!
File f = new File(pathname);
out.write("File already exists!
MultipartRequest up =