Changeset 24966

Show
Ignore:
Timestamp:
24.01.2012 15:06:17 (7 years ago)
Author:
papitha
Message:

The uploading will now create a backup of the file before it is overwritten

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java

    r24962 r24966  
    427427                    if(toFile.exists()) 
    428428                    { 
    429                         logger.error("Cannot move the stored file because the file \"" + storageLocation + "\" already exists"); 
    430                     } 
    431                     else 
    432                     { 
     429                        File backupFile = new File(toFile.getAbsolutePath() + System.currentTimeMillis()); 
     430                         
    433431                        logger.info("Moving uploaded file (" + uploadedFile.getAbsolutePath() + ") to " + toFile.getAbsolutePath()); 
    434                         uploadedFile.renameTo(toFile); 
    435                     } 
     432                        toFile.renameTo(backupFile); 
     433                    } 
     434                     
     435                    logger.info("Moving uploaded file (" + uploadedFile.getAbsolutePath() + ") to " + toFile.getAbsolutePath()); 
     436                    uploadedFile.renameTo(toFile); 
    436437                } 
    437438            }