Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
94
rated 0 times [  98] [ 4]  / answers: 1 / hits: 44970  / 9 Years ago, wed, june 3, 2015, 12:00:00

I need to get array of all images (or simply of all files) in directory (e.g. www.example.com/images/). I prefer to use JavaScript but it's hard to make. So should I use PHP, meybe?



Could you please help me - I'm not good at this.



Thank you very much!


More From » php

 Answers
6

Javascript cannot fetch all files on a server, as it is a client-side langugage.



http://php.net/manual/en/function.glob.php is what you need.



$all = glob('/path/to/dir/*.*');

$images = glob('/path/to/dir/*.{jpg,png,gif}');

[#66348] Tuesday, June 2, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bradleymoisesy

Total Points: 121
Total Questions: 105
Total Answers: 95

Location: Nepal
Member since Mon, Jan 4, 2021
3 Years ago
bradleymoisesy questions
Wed, Dec 22, 21, 00:00, 2 Years ago
Tue, Jun 1, 21, 00:00, 3 Years ago
Thu, Jun 11, 20, 00:00, 4 Years ago
Thu, Jan 16, 20, 00:00, 4 Years ago
;