You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Hunter Kelly <re...@eircom.net> on 2004/04/05 13:38:15 UTC

[BUG] IUploadFile not very smart about filenames and paths

I'm working on an application that uses uploaded files, and found the 
following very irritating behaviour.

The server runs on a Linux box, but when someone uploads a file using IE on a 
Windows machine, I get the following:

uploadedFile.getFileName: C: \work\NetDownload\Design\DDD_2003-04-15.pdf
uploadedFile.getFilePath: C:\work\NetDownload\Design\DDD_2003-04-15.pdf

This seems like a bug to me - the file name should be the actual name
of the file, with all the path information stripped.  

Since this is web software, I think the software needs to handle path names 
from multiple platforms, without pushing that work back onto the developer.

I've had to add the following to get this to work.  It's pretty 
straightforward, but it's something I believe that Tapestry should be doing
for me.

        IUploadFile uploadedFile = getUploadedFile();
        String[] fileNameParts = uploadedFile.getFileName().split("\\\\|/");
        String fileName = fileNameParts[fileNameParts.length-1];


Hunter

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: [BUG] IUploadFile not very smart about filenames and paths

Posted by Karel Miarka <ka...@issa.cz>.
It is already in Bugzilla:
http://issues.apache.org/bugzilla/show_bug.cgi?id=27544

Karel

----- Original Message ----- 
From: "Hunter Kelly" <re...@eircom.net>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Monday, April 05, 2004 1:38 PM
Subject: [BUG] IUploadFile not very smart about filenames and paths


> I'm working on an application that uses uploaded files, and found the
> following very irritating behaviour.
>
> The server runs on a Linux box, but when someone uploads a file using IE
on a
> Windows machine, I get the following:
>
> uploadedFile.getFileName: C: \work\NetDownload\Design\DDD_2003-04-15.pdf
> uploadedFile.getFilePath: C:\work\NetDownload\Design\DDD_2003-04-15.pdf
>
> This seems like a bug to me - the file name should be the actual name
> of the file, with all the path information stripped.
>
> Since this is web software, I think the software needs to handle path
names
> from multiple platforms, without pushing that work back onto the
developer.
>
> I've had to add the following to get this to work.  It's pretty
> straightforward, but it's something I believe that Tapestry should be
doing
> for me.
>
>         IUploadFile uploadedFile = getUploadedFile();
>         String[] fileNameParts =
uploadedFile.getFileName().split("\\\\|/");
>         String fileName = fileNameParts[fileNameParts.length-1];
>
>
> Hunter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org