You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by bu...@apache.org on 2004/03/09 17:18:56 UTC
DO NOT REPLY [Bug 27544] New: -
UploadPart / getFileName() doesn't work cross-platform
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27544>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=27544
UploadPart / getFileName() doesn't work cross-platform
Summary: UploadPart / getFileName() doesn't work cross-platform
Product: Tapestry
Version: 3.0
Platform: All
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Framework
AssignedTo: tapestry-dev@jakarta.apache.org
ReportedBy: karel.miarka@issa.cz
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;
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org