From ed37021577c01f14f3f4d6f3b5da18f6b56d5be4 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 7 Feb 2010 17:34:35 +0100 Subject: add function to generate file paths Signed-off-by: Florian Pritz --- system/application/controllers/file.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'system/application/controllers/file.php') diff --git a/system/application/controllers/file.php b/system/application/controllers/file.php index d22cb9dfe..fb114ee7b 100644 --- a/system/application/controllers/file.php +++ b/system/application/controllers/file.php @@ -68,7 +68,7 @@ class File extends Controller { $file_name = $_FILES['userfile']['name']; $folder = $this->file_mod->folder($file_hash); file_exists($folder) || mkdir ($folder); - $file = $folder.'/'.$file_hash; + $file = $this->file_mod->file($file_hash); $sql = ' INSERT INTO `files` (`hash`, `id`, `filename`, `password`, `date`) @@ -118,9 +118,7 @@ class File extends Controller { $mode = $this->uri->segment(4); $filedata = $this->file_mod->get_filedata($id); - - $folder = $this->file_mod->folder($filedata['hash']); - $file = $folder.'/'.$filedata['hash']; + $file = $this->file_mod->file($filedata['hash']); if ($this->file_mod->id_exists($id) && file_exists($file)) { // MODIFIED SINCE SUPPORT -- START @@ -216,7 +214,7 @@ class File extends Controller { array($oldest_time)); foreach($query->result_array() as $row) { - $file = $this->config->item('upload_path').'/'.substr($row['hash'], 0, 3).'/'.$row['hash']; + $file = $this->file_mod->file($row['hash']); if(filemtime($file) < $oldest_time) { unlink($file); $this->db->query('DELETE FROM files WHERE hash = ?', array($row['hash'])); -- cgit v1.2.3-24-g4f1b