How to set download path for Codeigniter download library on local computer?

I have the following path specified as upload_path for the download library included in Codeigniter.

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

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

I have permissions, so the directory can be written.

I added the registration to the download library and found that it does not perform this check in the library:

! @is_dir($this->upload_path)

My MacBook Pro development machine runs 10.6.2. I am using MAMP Pro. My directory structure looks like this:

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

Any help would be greatly appreciated. Thank you for your time.

+5
source share
2 answers

When loading a folder inside / application / you can use:

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

, hardcode - :

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

, APPPATH , realpath .

+9

, .

+3

All Articles