Reputation: 25048
If I do
$dir = './';
$files = glob( $dir . '*.png');
foreach( $files as $file) {
echo $file;
}
?>
And store the php file in the same folder as images I would get correct png files.
If I change location of php file How can I read png files located in other folder?
If I do
$dir = 'www.site.com/content/images';
$files = glob( $dir . '*.png');
foreach( $files as $file) {
echo $file;
}
it does not display anything, is it necessary to the php file with code to be in the same folder of images?
Upvotes: 2
Views: 218
Reputation: 63471
If you are in fact trying to retrieve files on a remote server, look at this:
http://www.php.net/manual/en/features.remote-files.php
Upvotes: 1
Reputation: 1900
You shouldn't add "www.site.com"
to path. You should use absolute path from the root of your server (beginning with "/"
: /content/images
) or relative path from current location of php script (content/images
).
Upvotes: 2