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/12/15 14:02:30 UTC

Required: Information on the Last Modification Time Stamp at the Client Side machine



Hi,

I used commons FileUpload [version FileUpload 1.1.1] for file upload
feature in servlet.Using API i am able to get all the required information
except the last modified time stamp of the file in the client side machine.

Code Snippet that i am using::
==============================
                        // 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();
                                    ....
                              }
                        }


Example,to expain my requirement:

      Consider a file SampleFile001.txt, Last Modified on the Client
Machine at :-- Tuesday, November 21,            2006, 3:12:11 PM

      Say the file was uploaded/written on to the Server file system using
the Commons API call on                   Wednesday,November 22, 2006,
3:12:11 PM.

      Then at the server side i can only retrieve the Creation TimeStamp of
the file on the server file         system(Wednesday,November 22,
2006,3:12:11 PM), where as i need the Time Stamp when the file was
last modified on the client machine(i.e,Tuesday, November 21,2006, 3:12:11
PM).

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: Required: Information on the Last Modification Time Stamp at the Client Side machine

Posted by Martin Cooper <ma...@apache.org>.
On 12/15/06, jitendra.takalkar@polaris.co.in <
jitendra.takalkar@polaris.co.in> wrote:
>
>
>
>
> Hi,
>
> I used commons FileUpload [version FileUpload 1.1.1] for file upload
> feature in servlet.Using API i am able to get all the required information
> except the last modified time stamp of the file in the client side
> machine.
>
> Code Snippet that i am using::
> ==============================
>                         // 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();
>                                     ....
>                               }
>                         }
>
>
> Example,to expain my requirement:
>
>       Consider a file SampleFile001.txt, Last Modified on the Client
> Machine at :-- Tuesday, November 21,            2006, 3:12:11 PM
>
>       Say the file was uploaded/written on to the Server file system using
> the Commons API call on                   Wednesday,November 22, 2006,
> 3:12:11 PM.
>
>       Then at the server side i can only retrieve the Creation TimeStamp
> of
> the file on the server file         system(Wednesday,November 22,
> 2006,3:12:11 PM), where as i need the Time Stamp when the file was
> last modified on the client machine(i.e,Tuesday, November 21,2006, 3:12:11
> PM).
>
> Plz suggest me solution


If your client is a browser, there is no solution. The browser simply does
not send this information when it submits a multipart request. To obtain
that information, you would have to use or write a custom upload client.

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