Hi,
I'm uploading a file and want to rename the file name after loaded. I couldn't find any method to do that. Can some one please let me know how to rename/delete a file in a file system? I can write this loaded file to a new file (dest) but couldn't delete the original file (src) File src = new File(fileName); File dest = new File(fileName + "." + "bak"); getFile().write(dest); // Works OK src.delete(); // Doesn't work src.renameTo(dest); //Doesn't work I've tried the following with no luck: // Move file (src) to File/directory dest. public static synchronized void moveFile(File src, File dest) throws FileNotFoundException, IOException { copyFile(src, dest); src.delete(); } // Copy file (src) to File/directory dest. public static synchronized void copyFile(File src, File dest) throws IOException { InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dest); // Transfer bytes from in to out byte[] buf = new byte[10240]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } in.close(); out.close(); } Thanks Naz -- View this message in context: http://www.nabble.com/T3%3A-IUploadFile-tp14369576p14369576.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]