Welcome Guest, Not a member yet? Register   Sign In
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

(This post was last modified: 02-23-2020, 02:40 AM by jreklund.)

Hi, wrap it with realpath().

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

(This post was last modified: 02-23-2020, 09:21 AM by dave friend.)

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




Theme © iAndrew 2016 - Forum software by © MyBB