Upload Path invalid on upload |
Hi,
I am new to codeigniter and undergoing a course in Udemy. I tried the upload library and i seem to have a problem with the 'upload_path' parameter. It always gives me an "invalid path" error. I have attached the screen caps of the code. Greatly appreciate if anyone can help me with this. Thank you in advance.
I suggest building the upload path like this
PHP Code: $config['upload_path'] = FCPATH . 'assets/images/'; FCPATH is the path to the folder where CI's index.php is found. An alternate way to build the path is this. PHP Code: $config['upload_path'] = str_replace('application', 'assets/images', APPPATH); I don't think either one is clearly superior, but the first is the simplest. That's good, right? jrekland's answer works too, but be aware that it won't include a trailing slash because realpath() removes trailing delimiters. I cannot remember if a trailing slash is important in this use-case or not.
Hi Guys,
Thank you for all the help. Great to see such good response. I tried all the suggestion but got the same results. Then after some digging, i found that this happens when the "upload" is autoloaded in the autoload.php file. I removed it and it works fine. |
Welcome Guest, Not a member yet? Register Sign In |