Changeset 24967
- Timestamp:
- 2012-01-24T15:19:50+13:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java
r24966 r24967 402 402 query_string += "&"; 403 403 } 404 405 if (current.getFieldName().equals(GSParams.FILE_LOCATION))404 405 if (current.getFieldName().equals(GSParams.FILE_LOCATION)) 406 406 { 407 407 storageLocation = current.getString(); … … 412 412 File file = new File(GlobalProperties.getGSDL3Home() + File.separator + "tmp" + File.separator + current.getName()); 413 413 File tmpFolder = new File(GlobalProperties.getGSDL3Home() + File.separator + "tmp"); 414 if (!tmpFolder.exists())414 if (!tmpFolder.exists()) 415 415 { 416 416 tmpFolder.mkdirs(); 417 417 } 418 418 current.write(file); 419 419 420 420 uploadedFile = file; 421 421 } 422 422 } 423 424 if(!storageLocation.equals("") && uploadedFile != null) 425 { 426 File toFile = new File(GlobalProperties.getGSDL3Home() + storageLocation); 427 if(toFile.exists()) 428 { 429 File backupFile = new File(toFile.getAbsolutePath() + System.currentTimeMillis()); 430 423 424 if (!storageLocation.equals("") && uploadedFile != null) 425 { 426 String[] locations = storageLocation.split(":"); 427 428 for (String location : locations) 429 { 430 File toFile = new File(GlobalProperties.getGSDL3Home() + location); 431 if (toFile.exists()) 432 { 433 File backupFile = new File(toFile.getAbsolutePath() + System.currentTimeMillis()); 434 435 logger.info("Backing up file (" + toFile.getAbsolutePath() + ") to " + backupFile.getAbsolutePath()); 436 toFile.renameTo(backupFile); 437 } 438 431 439 logger.info("Moving uploaded file (" + uploadedFile.getAbsolutePath() + ") to " + toFile.getAbsolutePath()); 432 toFile.renameTo(backupFile); 433 } 434 435 logger.info("Moving uploaded file (" + uploadedFile.getAbsolutePath() + ") to " + toFile.getAbsolutePath()); 436 uploadedFile.renameTo(toFile); 440 uploadedFile.renameTo(toFile); 441 } 437 442 } 438 443 }
Note:
See TracChangeset
for help on using the changeset viewer.