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)
|