• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Upload Path invalid on upload

#1
Question 
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.


Attached Files Thumbnail(s)
           
Reply

#2
Hi, wrap it with realpath().

PHP Code:
realpath(APPPATH.'../assets/images/'); 
Reply

#3
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.
Reply

#4
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.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.