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.
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.
When all else fails, use absolute paths.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With