[ http://issues.apache.org/jira/browse/TAPESTRY-127?page=all ]
Jesse Kuhnert resolved TAPESTRY-127:
------------------------------------
Fix Version: 4.0.1
Resolution: Fixed
Assign To: (was: Tapestry Developer List)
> UploadPart / getFileName() doesn't work cross-platform
> ------------------------------------------------------
>
> Key: TAPESTRY-127
> URL: http://issues.apache.org/jira/browse/TAPESTRY-127
> Project: Tapestry
> Type: Bug
> Components: Framework
> Versions: 3.0
> Environment: Operating System: Other
> Platform: All
> Reporter: Karel Miarka
> Fix For: 4.0.1
>
> It doesn't work when the client and server are on different platforms (which
> is
> very common). When a client uploads a file (c:\somedir\somefile.txt) from a
> Windows machine and Tapestry application is running on a Unix box the full
> path
> is returned (instead of just somefile.txt).
> In my opinion it doesn't work because the java.io.File uses
> separatorCharacter
> according to target platform, but it is not universal.
> This seems to work:
> String fileName = getFilePath();
> int pos;
> if ((pos = fileName.lastIndexOf('\\')) != -1) {
> fileName = fileName.substring(pos + 1);
> } else if ((pos = fileName.lastIndexOf('/')) != -1) {
> fileName = fileName.substring(pos + 1);
> }
> return fileName;
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]