Upload Path invalid on upload - 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: Upload Path invalid on upload (/showthread.php?tid=75573) |
Upload Path invalid on upload - murugappan - 02-22-2020 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. RE: Upload Path invalid on upload - jreklund - 02-23-2020 Hi, wrap it with realpath(). PHP Code: realpath(APPPATH.'../assets/images/'); RE: Upload Path invalid on upload - dave friend - 02-23-2020 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. RE: Upload Path invalid on upload - murugappan - 02-23-2020 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. |