Date: 2005-03-08T12:27:12
   Editor: DakotaJack
   Wiki: Apache Struts Wiki
   Page: StrutsUpload
   URL: http://wiki.apache.org/struts/StrutsUpload

   no comment

Change Log:

------------------------------------------------------------------------------
@@ -335,18 +335,18 @@
                             ((Integer)params[6]).intValue()); // maxFileSize
   }
 
-  private void handleRequest(HttpServletRequest req,            // params[0]   
   
-                             String             encoding,       // params[1]
-                             List               monitors,       // params[2]
-                             Map                parameterNames, // params[3]
-                             Map                files,          // params[4]
-                             String             repositoryPath, // params[5]
-                             int                maxFileSize)    // params[6]
-      throws IOException { 
+  private void handleRequest(HttpServletRequest req,
+                             String             encoding,
+                             List               monitors,
+                             Map                parameterNames,
+                             Map                files,
+                             String             repositoryPath,
+                             int                maxFileSize)
+      throws IOException {
     UploadFileItemFactory ufiFactory = new UploadFileItemFactory();
 
     ufiFactory.setMonitors(monitors);
-    ufiFactory.setCustom(req.getContentLength());
+    ufiFactory.setContentLength(req.getContentLength());
 
     DiskFileUpload dfu = new DiskFileUpload();
 
@@ -370,8 +370,8 @@
     Object obj = null;
 
     for(Iterator iterator = list.iterator(); iterator.hasNext();) {
-      FileItem fi       = (FileItem)iterator.next();
-      String          fieldName = fi.getFieldName();
+      FileItem fi        = (FileItem)iterator.next();
+      String   fieldName = fi.getFieldName();
 
       if(fi.isFormField()) {
         String data = null;
@@ -390,20 +390,16 @@
 
         names.add(data);
       } else {
-        String name = fi.getName();
+        String name        = fi.getName();
+        String ext         = name;
+        String contentType = null;
+        int    flag        = -99;
         if(name != null) {
-          MultipartFile uf = new UploadMultipartFile(fi);
-          name = name.replace('\\', '/');
-          int j = name.lastIndexOf("/");
-
-          if(j != -1) {
-            name = name.substring(j + 1, name.length());
-          }
-
-          uf.setName(name);
-          uf.setContentType(fi.getContentType());
-          uf.setSize(fi.getSize());
-          files.put(fieldName, uf);
+          MultipartFile mf = new UploadMultipartFile(fi);
+          mf.setName(name);
+          mf.setContentType(contentType = fi.getContentType());
+          mf.setSize(fi.getSize());
+          files.put(fieldName, mf);
         }
       }
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to