CodeIgniter Forums
I can't get it to view files i a directory! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: I can't get it to view files i a directory! (/showthread.php?tid=56697)



I can't get it to view files i a directory! - El Forum - 01-11-2013

[eluser]behnampmdg3[/eluser]
Hello;

Why can't I see anything? I need to see the files in this directory. The directory exists and is accessible. I dont get an error either!

Code:
$directory_url = base_url('upload/server/php/files');
$this->load->helper('directory');
$one = directory_map($directory_url);
$two = directory_map($directory_url, FALSE, TRUE);
$three = directory_map($directory_url, 1);
print_r($one);
echo "<hr />";
print_r($two);
echo "<hr />";
print_r($three);
echo "<hr />";
echo $directory_url;

Thanks



I can't get it to view files i a directory! - El Forum - 01-11-2013

[eluser]CroNiX[/eluser]
Because you're not accessing a directory...you're accessing a URL (using base_url())... Try using the full path to the dir.



I can't get it to view files i a directory! - El Forum - 01-11-2013

[eluser]behnampmdg3[/eluser]
[quote author="CroNiX" date="1357956015"]Because you're not accessing a directory...you're accessing a URL (using base_url())... Try using the full path to the dir.
[/quote]Would you please explain? I tired this below but no difference:
Code:
$directory_url = "http://nickdavis.com.au/sincity/website_admin/upload/server/php/files";
$this->load->helper('directory');
$one = directory_map($directory_url);

echo $directory_url;echo "<br />";
var_dump($one);
It prints:

Code:
http://nickdavis.com.au/sincity/website_admin/upload/server/php/files
bool(false)

Heres the folder

Thank you


I can't get it to view files i a directory! - El Forum - 01-11-2013

[eluser]CroNiX[/eluser]
Yes, as I said that's a url. It starts with http. You need the local file path on the server (which is what that url is accessing).
Code:
/home/users/or/whatever/sincity/website_admin/upload/server/php/files

See the examples in the docs for the directory helper. It's not using a url.


I can't get it to view files i a directory! - El Forum - 01-11-2013

[eluser]behnampmdg3[/eluser]
[quote author="CroNiX" date="1357957909"]Yes, as I said that's a url. It starts with http. You need the local file path on the server (which is what that url is accessing).
Code:
/home/users/or/whatever/sincity/website_admin/upload/server/php/files

See the examples in the docs for the directory helper. It's not using a url.[/quote]Many thanks. Got it working.

Cheers