tags:

views:

193

answers:

2

I have the following path set as the upload_path for Upload library included with Codeigniter.

 $this->upload_config['upload_path'] = './uploads/working/';

This path works fine on the remote server. However, when I'm debugging locally, it fails.

I have permissions set so the directory is writeable.

I added logging to the upload library and found that it is failing this check in the library:

! @is_dir($this->upload_path)

My development machine is a MacBook Pro running 10.6.2. I'm using MAMP Pro. My directory structure looks like:

app
cache
ci_1_7_2
html
 - css
 - images
 - index.php
 - js
 - uploads
   - large
   - normal
   - small
   - working

Any help would be greatly appreciated. Thanks for your time.

+1  A: 

When all else failes, use absolute paths.

stormdrain
+1  A: 

When uploads folder is inside /application/ you can use:

$this->upload_config['upload_path'] = APPPATH . 'uploads/working/';

But for this structure, hardcode an absolute path or use:

$this->upload_config['upload_path'] = realpath(dirname(__FILE__)). '/uploads/working/';

Notice that APPPATH contains a trailing slash but realpath will strip the trailing slash.

Phil Sturgeon
Thanks Phil. I'll give this a shot. I really appreciate it.
someoneinomaha