Changeset 24966


Ignore:
Timestamp:
01/24/12 15:06:17 (9 years ago)
Author:
papitha
Message:

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

File:
1 edited

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            }
Note: See TracChangeset for help on using the changeset viewer.