Forum Moderators: open

Message Too Old, No Replies

Using JavaScript to Grab Latest Image from DIR

Is it possible?

         

wfernley

4:55 pm on Mar 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I need to create a JavaScript that will look to a directory contain a bunch of images. It will need to tell which of the images is the latest image and display that on a webpage. It will also need to check for the latest graphic every 30 seconds.

Is this possible? :S

Thanks in advance for your help!

Wes

RonPK

7:05 pm on Mar 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



JavaScript is a client side script language. It runs in your browser. It can communicate with a server, but you will need a server side script to do things on the server side.

wfernley

8:05 pm on Mar 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So even if the JavaScript is placed on the server it will not work?

Would PHP Work?

Bernard Marx

8:10 pm on Mar 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That depends on what scripting environments you have available on the server:

ASP -> JScript(Javascript), VBScript (, and others..)
PHP

RonPK

8:13 pm on Mar 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



PHP and other server side languages can indeed read the contents of a server directory and figure out which file was the last one added.

wfernley

8:23 pm on Mar 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Great, thanks for the info. Maybe I will try looking in the PHP forum :)

Thanks again!

Wes