commons-user mailing list archives

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

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
try
{
 List items = upload.parseRequest(request);

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

...
...
...

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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message