cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Cocoon Wiki] Update of "RecipeUploadUsingAction" by JacobArnold
Date Wed, 13 Jul 2005 20:20:59 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Cocoon Wiki" for change notification.

The following page has been changed by JacobArnold:
http://wiki.apache.org/cocoon/RecipeUploadUsingAction

The comment on the change is:
Fixed sample code for platform-independence

------------------------------------------------------------------------------
  	 * @param uploadedFileName
  	 */
  	public void setUploadedFileName(String uploadedFileName) {
+ 		// Type of slash depends on browser's platform, not server platform
-                 //stavros's patch
-                 String slash = File.separator;
-                 int lastSlash = uploadedFileName.lastIndexOf(slash);
+ 		int lastSlash = uploadedFileName.lastIndexOf('/');
+ 		if (lastSlash == -1) {
+ 			lastSlash = uploadedFileName.lastIndexOf('\\');
+ 		}
-                 String onlyFileName = uploadedFileName.substring(lastSlash+1);
+ 		this.uploadedFileName = uploadedFileName.substring(lastSlash+1);
-   
-                 this.uploadedFileName = onlyFileName;
  	}
  
  	/* (non-Javadoc)

Mime
View raw message