The root path of a site in CodeIgniter

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

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

The application folder is located in: c:\wamp\www\mysite\application\

Therefore, when I boot to the server, the absolute path will be different. So how to get the absolute root path to use with the upload_path configuration to load the class?

+6
source share
3 answers

This happens late, but the right way:

 FCPATH.'uploads'; 
+4
source

If the uploads folder is located in the root directory of your site, you can simply use ./uploads in your download path configuration.

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

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

like this APPPATH.'uploads / images / ';

0
source

Source: https://habr.com/ru/post/947493/


All Articles