commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mart...@apache.org
Subject svn commit: r409431 - /jakarta/commons/proper/fileupload/trunk/xdocs/faq.fml
Date Thu, 25 May 2006 18:58:32 GMT
Author: martinc
Date: Thu May 25 11:58:31 2006
New Revision: 409431

URL: http://svn.apache.org/viewvc?rev=409431&view=rev
Log:
Some rewording and copyright update.

Modified:
    jakarta/commons/proper/fileupload/trunk/xdocs/faq.fml

Modified: jakarta/commons/proper/fileupload/trunk/xdocs/faq.fml
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/fileupload/trunk/xdocs/faq.fml?rev=409431&r1=409430&r2=409431&view=diff
==============================================================================
--- jakarta/commons/proper/fileupload/trunk/xdocs/faq.fml (original)
+++ jakarta/commons/proper/fileupload/trunk/xdocs/faq.fml Thu May 25 11:58:31 2006
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <!--
-   Copyright 2005 The Apache Software Foundation
+   Copyright 2005-06 The Apache Software Foundation
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -59,22 +59,25 @@
       </answer>
     </faq>
 
-        <faq id="whole-path-from-IE">
-          <question>
-            Why does FileItem.getName() returns the whole path, and not just the filename?
-          </question>
-          <answer>
-            Internet Explorer returns the entire path to the uploaded file and 
-            not just the expected filename. Currently, FileUpload does not attempt 
-            to hide this from the user and so a work-around is required: 
-            <pre>
+    <faq id="whole-path-from-IE">
+      <question>
+        Why does FileItem.getName() return the whole path, and not just the file name?
+      </question>
+      <answer>
+        Internet Explorer provides the entire path to the uploaded file and not
+        just the base file name. Since FileUpload provides exactly what was
+        supplied by the client (browser), you may want to remove this path
+        information in your application. You can do that using the following
+        method from Commons IO (which you already have, since it is used by
+        FileUpload).
+        <pre>
     String fileName = item.getName();
-    if(fileName != null) {
-      fileName = new java.io.File(fileName).getName();
+    if (fileName != null) {
+        filename = FilenameUtils.getName(filename);
     }
-            </pre>
-          </answer>
-        </faq>
+        </pre>
+      </answer>
+    </faq>
   </part>
 
   <part id="struts">



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message