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 21:48:45 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:
Moved stripping of path from FileUploadInfo to FileUploadAction

------------------------------------------------------------------------------
      	
      
      	/*
-     	 * go thrue form parameters
+     	 * go thru form parameters
      	 * add to return Map FileUploadInfo object to get informations about 
      	 * uploaded file
      	 */	
@@ -548, +548 @@

      			// do upload flag
      			boolean doUpload = true;
      			
+ 			// strip off path (IE for Windows includes it)
+ 			String filename = filePart.getUploadName();
+ 			int lastSlash = filename.lastIndexOf('\\');
+ 			filename = uploadedFileName.substring(lastSlash+1);
+ 
      			// set fileinfo
-     			fileInfo.setOriginalFileName(filePart.getUploadName());
+     			fileInfo.setOriginalFileName(filename);
      			fileInfo.setUploadedFileName(fileInfo.getOriginalFileName());
      			
      			// define file target
@@ -838, +843 @@

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

Mime
View raw message