Hello everyone, I am using the FileUpload package to upload files and my JSP code looks like this…
------------------------- DiskFileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); List <FileItem> items = upload.parseRequest(request); Iterator iter = items.iterator(); while (iter.hasNext()) { FileItem item = (FileItem) iter.next(); if (!item.isFormField()) { String fileName = item.getName(); File uploadedFile = new File("C:\\temp\\uploaded\\" + fileName); try{ item.write(uploadedFile); //this line fails } catch(Exception e) { out.write(e.getLocalizedMessage()); } ------------------- The code above does not work when the file names are in Japanese. The filename changes into ‘????.ext’ and thus becomes an illegal file name – hence the item.write(uploadedFile) line fails. If I would like to retain the original filename, what should I do to my code? Thanks for your help. Regards, Pradeep Please consider our environment before printing this email. This e-mail and any files transmitted with it are privileged and confidential information intended for the use of the addressee. The confidentiality and/or privilege in this e-mail is not waived, lost or destroyed if it has been transmitted to you in error. If you have received this e-mail in error you must (a) not disseminate, copy or take any action in reliance on it; (b) notify itsupp...@customware.net and the sender immediately; and (c) delete the original e-mail. Please consider our environment before printing this email. This e-mail and any files transmitted with it are privileged and confidential information intended for the use of the addressee. The confidentiality and/or privilege in this e-mail is not waived, lost or destroyed if it has been transmitted to you in error. If you have received this e-mail in error you must (a) not disseminate, copy or take any action in reliance on it; (b) notify itsupp...@customware.net and the sender immediately; and (c) delete the original e-mail. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org