Jump to content

Listing Directory into a javascript array! Help Pls!


iPixel

Recommended Posts

So i pass 2 variables to a js function. Image Source and the Image Name.

 

I want to use the image name to know what image i should show to the user first but i need to use the image source in order to look into a specified directory, find all the files that exist there and place all the filenames into a javascript array.

 

function showgallery(imgsrc,img)
  {
         // Do some fancy stuff to show Large Photo here... (this part i can do)
         
         // Get Directory listed and placed into array so that i can do previous / next photo changing. --- THIS PART I NEED HELP WITH
  }

 

Thanks Much!

You cannot do this with javascript. You have to use server-side script to get a list of files in directory on server and output it to the client (in the form of a js array or whatever).  You can do it on page load or use ajax to make a request to server-side script to get a listing and return results.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.