CodeIgniter Forums
File Upload class errors array? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: File Upload class errors array? (/showthread.php?tid=31425)



File Upload class errors array? - El Forum - 06-18-2010

[eluser]mikedfunk[/eluser]
In the Form Validation class I can do this:

Code:
$errors = $this->form_validation->getErrorsArray();

but that doesn't work in the File Upload class, I get a fatal error. How can I get an array of the errors in the File Upload class? $this->upload->display_errors() is a string and I haven't been able to convert it to JSON because of the key for each error.


File Upload class errors array? - El Forum - 06-18-2010

[eluser]mikedfunk[/eluser]
Nevermind, I just extended the upload class by adding this in MY_Upload.php in the application->libraries folder:


Code:
<?php

class MY_Upload extends CI_Upload {

    function getErrorsArray()
    {
        return $this->error_msg;
    }