I have a project with CODEIGNITER where I have to upload files that is running well in localhost. But problem started when I uploaded the file into linux cpanel .file is not uploading also I have to find image from the folder that I did with the $_SERVER['DOCUMENT_ROOT'].'/project/sliderImages/'; but that also not working in cpanel . i am unable to solve the problem !
Can anyone please help me ? Thanks in advance
Locally my file upload folder location is
C:/wamp64/www/admin/sliderImages
and in cpanel its location is
public_html/admin/sliderImages
here admin is my project folder name under which there are all codeigniter file and folder .
i used upload path in codeigniter is
$config['upload_path'] = './sliderImages/';
and to find all images in that folder i used
$path = $_SERVER['DOCUMENT_ROOT'].'/admin/sliderImages/';
$files = glob($path.'*'); // get all file names
so tell me or give me any link that how can i upload and fetch file from folder with codeigniter in cpanel that i did in localhost !
also i have 755 folder permission for the folder in cpanel .
when i uploaded my project in cpanel and trying to upload a image in the folder it's showing an error like
Array ( [error] =>
The upload path does not appear to be valid.
)
why not try using relative path from index.php as all of your code will be executing from index.php. So try
$path = 'admin/sliderImages/';
$files = scandir($path); // get all file names
start with config file
$config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'];
This will make your upload path to be base_url('admin/sliderImages');
Let CI sort the urls and don't forget to endit the .htaccess file to reflect server configs