read File names
I am trying to write something that gets all the images in a single folder and then puts them into an array so that on my web page they can randomly be up there.
As you can see right now I am putting the image names in hard coded but when I give this to the client I would like for them to be able to just upload pictures to the folder without having to go in and change the JS
var myPics = new Array();
myPics = "pics/cup.jpg";
myPics = "pics/championship.jpg";
how can I do this to get the file names into JS so that they can be used?
sorry, can't help with the topic. i'm not experienced with server side language. ask in sever-side development forum. i'm sure guys there will help you, or hopefully someone here will tell you. my apologies...
if you don't have an index page in a folder, but rather it shows a directory listing, you can load the folder URL in ajax, rake out the anchor tags that point to images, and build your array from that info.
in that case, you don't need any server-side code.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)