![]() |
upload image - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: upload image (/showthread.php?tid=65167) |
upload image - davy_yg - 05-09-2016 Hello, I trying to practice uploading image: http://www.codersmount.com/2012/11/upload-image-and-create-multiple-thumbnail-sizes-in-codeigniter/ I don't think it works: views/main.php PHP Code: <?php controllers/upload.php PHP Code: class Upload extends CI_Controller{ models/upload_model.php PHP Code: <?php I also get this error message: http://localhost/upload/ Fatal error: Call to undefined function form_open_multipart() in C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\upload\application\views\main.php on line 14 A PHP Error was encountered Severity: Error Message: Call to undefined function form_open_multipart() Filename: views/main.php Line Number: 14 Backtrace: Can anyone help me fix this error? Thanks in advance. RE: upload image - JayAdra - 05-10-2016 Sounds like you need to load the form_helper: http://www.codeigniter.com/userguide3/helpers/form_helper.html RE: upload image - davy_yg - 05-10-2016 I already load: controllers/upload.php PHP Code: <?php models/upload_model.php PHP Code: <?php A PHP Error was encountered Severity: Notice Message: Undefined property: Upload::$upload_model Filename: controllers/upload.php Line Number: 15 Backtrace: File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\upload\application\controllers\upload.php Line: 15 Function: _error_handler File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\upload\index.php Line: 315 Function: require_once Fatal error: Call to a member function do_upload() on null in C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\upload\application\controllers\upload.php on line 15 A PHP Error was encountered Severity: Error Message: Call to a member function do_upload() on null Filename: controllers/upload.php Line Number: 15 Backtrace: upload.php Line 15: $this->upload_model->do_upload(); //execute the upload function That's the error! Can anyone help me fix the error? RE: upload image - JayAdra - 05-10-2016 There are a number of things wrong here. I think you need to learn the basics of PHP and of CI and practise debugging yourself. The error you're getting (if you read it) clearly tells you the problem and where to find it. "$upload_model" is an undefined property on line 15. So on that line you see that you're calling "$this->upload_model->do_upload();", but CI doesn't know what that model is, because you haven't loaded it. Also, in your "upload_model.php" file, the class name is "User_model" so you need to update that to conform. There's a good chance after fixing those things, you'll have other errors. If so, read them carefully and see if you can find the problem yourself. |