Reputation: 5
I'm trying to access Code Igniter file from outside php file.
In my php file the destination folder is :
$doc_dir = '../admin/public/upload';
But my php file is located in the same level of admin folder(which is outside CI). So could you please suggest me how do I access the 'upload' folder (which is in CI) from student folder
/admin
public
upload
/student
abc.php
Upvotes: 0
Views: 194
Reputation: 1379
Try one of these: THis:
$doc_dir = dirname(__FILE__) . '/admin/public/upload';
Or This:
$doc_dir = explode("/",getcwd());
$doc_dir[count($doc_dir)-1] = "admin";
$doc_dir = implode("/",$doc_dir);
$doc_dir = $doc_dir."/public/upload";
One of the above approach will work. The approach is to get the absolute path, so there are many ways to get absolute path, you can implement in your own way which you like.
Upvotes: 1