Modular CI uploading problem |
[eluser]the_unforgiven[/eluser]
Hi All, I have setup an application using modular CI from wiredesignz and set up a MY_Model. Now in the model specific to this module i have a validation check: Code: public function validation_rules() MY_Model - >http://pastebin.com/FpaF0mvk Module Controller -> http://pastebin.com/kQvGypP9 Form itself ->http://pastebin.com/e57f2bn0 The do_upload function is located in wc_portlets.php inside modules>portlets>models>wc_portlets.php and has this on -> http://pastebin.com/KeEiev3G among other stuff which isn't relevant. So the do_upload should i move that to the MY_Model firstly and then how would i call it in the rules array shown above? HELP, massively appreciated. Cheers
[eluser]TheFuzzy0ne[/eluser]
I suspect it's because your callbacks need to be one of the following. 1) A method in your controller 2) A function 3) A method in the form validation library, either existing, or if you extend the validation library.
[eluser]the_unforgiven[/eluser]
I have added this: Code: public function _do_upload_file() To the controller, but still no joy, any idea's
[eluser]the_unforgiven[/eluser]
It's uploading to the folder but not saving to the database. Here's the code all in one link > http://pastebin.com/e6yX7L7M
[eluser]TheFuzzy0ne[/eluser]
Did you read the help file for MXHMVC? It says: When using form validation with MX you will need to extend the CI_Form_validation class as shown below, Code: <?php before assigning the current controller as the $CI variable to the form_validation library. This will allow your callback methods to function properly. (This has been discussed on the CI forums also). Code: <?php
[eluser]TheFuzzy0ne[/eluser]
Also, if the image cannot be resized, you set the message using $this->upload->display_errors(). It would probably make more sense to show the error from the image_lib object, since there won't be an error from the uploads library.
[eluser]the_unforgiven[/eluser]
looks like: Code: class Form_Validation_Model extends MY_Model {
[eluser]TheFuzzy0ne[/eluser]
You are extending MY_Model, and you need to extend CI_Form_validation: Code: class MY_Form_validation extends CI_Form_validation {
[eluser]the_unforgiven[/eluser]
No I get : A PHP Error was encountered Severity: Notice Message: Undefined property: Wc_pages::$load Filename: core/Form_Validation_Model.php Line Number: 14 Fatal error: Call to a member function library() on a non-object in /Applications/MAMP/htdocs/site/application/core/Form_Validation_Model.php on line 14 |
Welcome Guest, Not a member yet? Register Sign In |