From fc0e2000733536fedd2da6ca2b219382c2f98518 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 12 Jun 2011 21:04:13 +0200 Subject: upload_error: print more precise error message Signed-off-by: Florian Pritz --- application/controllers/file.php | 11 ++++++++++- application/views/file/upload_error.php | 2 +- application/views/file_plaintext/upload_error.php | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) (limited to 'application') diff --git a/application/controllers/file.php b/application/controllers/file.php index 0f5b53d5e..b1804b42f 100644 --- a/application/controllers/file.php +++ b/application/controllers/file.php @@ -131,8 +131,17 @@ class File extends CI_Controller { $extension = $this->input->post('extension'); if(!isset($_FILES['file']) || $_FILES['file']['error'] !== 0) { $this->output->set_status_header(400); + $errors = array( + 0=>"There is no error, the file uploaded with success", + 1=>"The uploaded file exceeds the upload_max_filesize directive in php.ini", + 2=>"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form", + 3=>"The uploaded file was only partially uploaded", + 4=>"No file was uploaded", + 6=>"Missing a temporary folder" + ); + $data["msg"] = $errors[$_FILES['file']['error']]; $this->load->view($this->var->view_dir.'/header', $data); - $this->load->view($this->var->view_dir.'/upload_error'); + $this->load->view($this->var->view_dir.'/upload_error', $data); $this->load->view($this->var->view_dir.'/footer'); return; } diff --git a/application/views/file/upload_error.php b/application/views/file/upload_error.php index 606110d83..9df86b8a8 100644 --- a/application/views/file/upload_error.php +++ b/application/views/file/upload_error.php @@ -1,6 +1,6 @@

An error occurred while uploading.
- Most likely your file is too big or has not been uploaded completely. +

diff --git a/application/views/file_plaintext/upload_error.php b/application/views/file_plaintext/upload_error.php index c1482de27..c86c56911 100644 --- a/application/views/file_plaintext/upload_error.php +++ b/application/views/file_plaintext/upload_error.php @@ -1,2 +1,2 @@ -An error occurred while uploading. Most likely your file is too big or has not been uploaded completely. +An error occurred while uploading. -- cgit v1.2.3-24-g4f1b