![]() |
how extends form validation with custom file check validation? - 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: how extends form validation with custom file check validation? (/showthread.php?tid=74367) |
how extends form validation with custom file check validation? - aguileraq - 09-16-2019 Hi, i am trying to create a custom validation to verify the file type and desire, extend the form validation class, but I don't get results ... my code: https://gist.github.com/aguileraq/573e34258038c775561dd3db348f30ed and this is my response: Code: { All validation return a message but field picture return nothing... any suggestion? thanks for your help RE: how extends form validation with custom file check validation? - php_rocs - 09-17-2019 @aguileraq, What trouble shooting have you done? Have you checked the returned fields in the browser? Have you checked the values obtained by CI prior to validation? RE: how extends form validation with custom file check validation? - aguileraq - 09-17-2019 Hi @php_rocs Quote:Have you checked the returned fields in the browser?yes, i have an ajax response (see the response part in the first post) Quote:Have you checked the values obtained by CI prior to validation no, I have not checked that the post returns RE: how extends form validation with custom file check validation? - jreklund - 09-17-2019 You are trying to access $_FILES['file'] instead of $_FILES['picture']. But just try to return false, to see if it's working or not. And please remove xss_clean from everywhere, it's not supposed to be used: https://codeigniter.com/userguide3/installation/upgrade_300.html#step-13-check-for-usage-of-the-xss-clean-form-validation-rule RE: how extends form validation with custom file check validation? - aguileraq - 09-17-2019 (09-17-2019, 12:03 PM)jreklund Wrote: You are trying to access $_FILES['file'] instead of $_FILES['picture']. But just try to return false, to see if it's working or not. Hi @jreklund , thanks for the answer; I already tried to change file by image and I still don't get the validation message, just by returning false I don't know what else to try ![]() RE: how extends form validation with custom file check validation? - php_rocs - 09-17-2019 @aguileraq, Try a var_dump before validation to see what the array values are? RE: how extends form validation with custom file check validation? - aguileraq - 09-17-2019 (09-17-2019, 08:22 PM)php_rocs Wrote: @aguileraq, Hi again, i make two tests. I did 2 tests, the first one: PHP Code: public function createPost(){ and the response: Code: C:\wamp64\www\acv1\application\controllers\Military.php:39: the last test: PHP Code: public function createPost(){ and the response: empty input file: Code: C:\wamp64\www\acv1\application\controllers\Military.php:39: with a file: Code: C:\wamp64\www\acv1\application\controllers\Military.php:39: RE: how extends form validation with custom file check validation? - php_rocs - 09-19-2019 @aguileraq, I don't see the field picture in the array. Should it be there? RE: how extends form validation with custom file check validation? - aguileraq - 09-20-2019 (09-19-2019, 06:37 AM)php_rocs Wrote: @aguileraq, Hi @php_rocs, answering your question.. yes, but thats the problem... for some reason when put this funcion on extended library (form_validation) nothing happend.. but when the function is in the same controller, i call that function with the prefix "callback_".. and works.. ![]() RE: how extends form validation with custom file check validation? - php_rocs - 09-20-2019 @aguileraq, Here is a suggestion to follow for creating a callback function...https://codeigniter.com/user_guide/libraries/form_validation.html?highlight=callback#callbacks-your-own-validation-methods |