commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Inma Marín <>
Subject How to obtain a file last modification date
Date Wed, 02 Jan 2008 16:22:06 GMT
Hi all,


I would like to know how to get a file last modification time, if it is
possible. The file is included in a multipart request and is obtained as




            org.apache.commons.fileupload.DiskFileUpload fu = new

            java.util.List fileItems = fu.parseRequest(request);

            java.util.Iterator it = fileItems.iterator();


            org.apache.commons.fileupload.FileItem item = null;

            while (it.hasNext()){

  item = (org.apache.commons.fileupload.FileItem);


                if (item.isFormField()) { // Es un campo normal así que
comprobamos el nombre y lo recuperamos.

                        String itemName = item.getFieldName();


                        if (itemName.equals("…")){




                    org.apache.commons.fileupload.FileItem fi =

                    doc = fi.getString();  


                    //File name

                    String fname = item.getName();


                    //File size

                    Strinf fsize = String.valueOf(item.getSize());


                //Last modification date??



Could anybody be so kind as to help me, please?


Thank you very much in advance.




Inmaculada Marín López
Edificio ATICA - Planta baja
Campus de Espinardo
Universidad de Murcia
Teléfono +34 968 367906


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message