From 6c2dab5c505730817c173d6b6024679bda9f3df5 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 8 Nov 2011 15:45:27 -0500 Subject: [PATCH] Remove temporary upload if we have a duplicate. --- application/controllers/upload.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/application/controllers/upload.php b/application/controllers/upload.php index 5669313..a5eb174 100644 --- a/application/controllers/upload.php +++ b/application/controllers/upload.php @@ -29,10 +29,12 @@ class Upload extends CI_Controller { $duplicate = $this->fileupload->check_duplicate($hash); if($duplicate) { + unlink($upload['full_path']); + $message = array('type'=>'error', 'status'=>'file already exists:' . $duplicate); } else { $file_name = $this->fileupload->add_upload($upload['file_ext'], $upload['client_name'],$hash); - + rename($upload['full_path'], $upload['file_path'] . $file_name . $upload['file_ext']); $config = array(