diff --git a/lib/documentmanagement/documentutil.inc.php b/lib/documentmanagement/documentutil.inc.php index 682cc3b..47c5007 100644 --- a/lib/documentmanagement/documentutil.inc.php +++ b/lib/documentmanagement/documentutil.inc.php @@ -580,8 +580,8 @@ class KTDocumentUtil { } KTDocumentUtil::setComplete($oDocument, 'contents'); - if ($aOptions['cleanup_initial_file']) { - //@unlink($sFilename); + if ($aOptions['cleanup_initial_file'] && file_exists($sFilename)) { + @unlink($sFilename); } return true; diff --git a/lib/storage/ondiskhashedstoragemanager.inc.php b/lib/storage/ondiskhashedstoragemanager.inc.php index 426fbff..1c7cf12 100644 --- a/lib/storage/ondiskhashedstoragemanager.inc.php +++ b/lib/storage/ondiskhashedstoragemanager.inc.php @@ -59,8 +59,10 @@ class KTOnDiskHashedStorageManager extends KTStorageManager { global $default; $default->log->info(sprintf("Uploaded %d byte file in %.3f seconds", $file_size, $end_time - $start_time)); - //remove the temporary file - @unlink($sTmpFilePath); + //remove the temporary file if it was uploaded + if (is_uploaded_file($sTmpFilePath)){ + @unlink($sTmpFilePath); + } if (file_exists($sDocumentFileSystemPath)) { return true; } else {