You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by ji...@polaris.co.in on 2006/07/10 09:19:27 UTC

File Name at server side is always in lower case! Is it possible to get File Name as it is in client side?


Hi,

I used commons FileUpload for file upload feature in servlet.

using API i get all the required information but

I am struggling a on small issue ...


Here's my requirement...

i want File name as it ...



Code ::


                        // Create a factory for disk-based file items
                        DiskFileItemFactory factory = new
DiskFileItemFactory(
                                    yourMaxMemorySize, yourTempDirectory);

                        // Create a new file upload handler
                        ServletFileUpload upload = new
ServletFileUpload(factory);

                        // Parse the request
                        List /* FileItem */items =
upload.parseRequest(request);

                        // Process the uploaded items
                        Iterator iter = items.iterator();
                        while (iter.hasNext()) {
                              FileItem item = (FileItem) iter.next();

                              if (!item.isFormField()) {
                                    clientFileName = item.getName();
                                    sizeInBytes = item.getSize();
                                    ....
                              }
                        }



i used above code to get required information about selected file.

but i always get file name in lower case format

For Example:

      Selected File Name:
            c:\upload\SampleFile001.txt


      File Name after API Call:
            c:\upload\samplefile001.txt



      Expecting:
            c:\upload\SampleFile001.txt




Plz suggest me solution


Thanks!

This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only.  If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.

Visit us at http://www.polaris.co.in

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


Re: File Name at server side is always in lower case! Is it possible to get File Name as it is in client side?

Posted by Martin Cooper <ma...@apache.org>.
On 7/10/06, jitendra.takalkar@polaris.co.in <ji...@polaris.co.in>
wrote:
>
>
>
> Hi,
>
> I used commons FileUpload for file upload feature in servlet.
>
> using API i get all the required information but
>
> I am struggling a on small issue ...
>
>
> Here's my requirement...
>
> i want File name as it ...
>
>
>
> Code ::
>
>
>                         // Create a factory for disk-based file items
>                         DiskFileItemFactory factory = new
> DiskFileItemFactory(
>                                     yourMaxMemorySize, yourTempDirectory);
>
>                         // Create a new file upload handler
>                         ServletFileUpload upload = new
> ServletFileUpload(factory);
>
>                         // Parse the request
>                         List /* FileItem */items =
> upload.parseRequest(request);
>
>                         // Process the uploaded items
>                         Iterator iter = items.iterator();
>                         while (iter.hasNext()) {
>                               FileItem item = (FileItem) iter.next();
>
>                               if (!item.isFormField()) {
>                                     clientFileName = item.getName();
>                                     sizeInBytes = item.getSize();
>                                     ....
>                               }
>                         }
>
>
>
> i used above code to get required information about selected file.
>
> but i always get file name in lower case format
>
> For Example:
>
>       Selected File Name:
>             c:\upload\SampleFile001.txt
>
>
>       File Name after API Call:
>             c:\upload\samplefile001.txt
>
>
>
>       Expecting:
>             c:\upload\SampleFile001.txt
>
>
>
>
> Plz suggest me solution


Use the latest release - this was an issue in FileUpload 1.1 that was fixed
in FileUpload 1.1.1, which was released in June.

--
Martin Cooper


Thanks!
>
> This e-Mail may contain proprietary and confidential information and is
> sent for the intended recipient(s) only.  If by an addressing or
> transmission error this mail has been misdirected to you, you are requested
> to delete this mail immediately. You are also hereby notified that any use,
> any form of reproduction, dissemination, copying, disclosure, modification,
> distribution and/or publication of this e-mail message, contents or its
> attachment other than by its intended recipient/s is strictly prohibited.
>
> Visit us at http://www.polaris.co.in
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>