Upload Model issues. |
I am creating an upload script for my signed in users.
Libraries included: form, upload and image_lib. From the controller I want to call upon the add image function, from the user model. From the user model I want it to attempt to upload the file using the upload model. And once the upload is complete I want the user model to create the thumbnails and add to database. I get a dreaded The upload path does not appear to be valid. every single time. I know the path works as I wrote echo $config['upload_path'] and copied the result in my browser and it took me to the directory. Could someone shed some light on why I always get the error? In my controller/profile.php I have: PHP Code: if($this->input->post()) In my models/user_model.php I have: PHP Code: function add_image() In my models/upload_model.php I have: PHP Code: function upload($config)
In models/upload_model.php, before:
PHP Code: if ($this->upload->do_upload()) you probably need to add: PHP Code: $this->load->library('upload', $config); Otherwise, wherever you're loading the upload library is where you're getting the $config values, so your upload path is probably set to a default value rather than the $config value you're passing to your model. |
Welcome Guest, Not a member yet? Register Sign In |