Vpp Man
Vpp Man

Reputation: 2546

Root path of site in CodeIgniter

I am using Uploading Class to upload images. But the location where my uploaded images will be stored is: http://www.mysite.com/uploads/

Absolute path to this folder is: c:\wamp\www\mysite\uploads\

Application folder is in : c:\wamp\www\mysite\application\

So when I upload to server, absolute path will not be same. So, how to get absolute root path to use with the upload_path config of Uploading Class?

Upvotes: 8

Views: 29006

Answers (3)

Vishal P Gothi
Vishal P Gothi

Reputation: 997

Please use APPPATH you will get the directory path of your site root directory.

like this APPPATH.'uploads/images/';

Upvotes: 1

JobSam
JobSam

Reputation: 317

This is coming late but the right path is:

FCPATH.'uploads';

Upvotes: 7

Amin.Che
Amin.Che

Reputation: 511

If the uploads folder is in the root of your site then you can simply use ./uploads in your upload path configuration.

$config['upload_path'] = "./uploads";

Upvotes: 1

Related Questions