commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mihael Knezevic <>
Subject [FileUpload] Getting wrong filename from FileItem
Date Wed, 04 May 2005 11:04:29 GMT

i'm quite new to this project and perhaps i'm making some mistakes. perhaps 
you can help me.

i'm trying to upload a file from a windows desktop to a linux server running 
tomcat 5.0.28. 

i'm using the following code to get a FileItem object:

// create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory());
// parse the request
 List items = upload.parseRequest(request);

 for (Iterator iter = items.iterator(); iter.hasNext();)
  FileItem element = (FileItem);


now when i use the element.getName() method i'm getting the full path (C:
\mydir\myfile.txt) instead of just name of the file (myfile.txt). there is no 
problem if the client is also a linux client. has it to do with the different 
file separator characters?

any help will be appreciated very much.

thanx in advance

mihael knezevic

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message