Checking FTP folder for filenames in HTML

114 views Asked by At

I'm relatively new to HTML/CSS and recently was hired to rework a clients website.

Here is my dilemma: They have an FTP folder that only can contain the same set of images for corresponding browser sizes (320.png, 640.png, 768.png, etc.) What I am trying to do is check the folder for file names and return boolean values for each file that is/isn't in the folder.

Every solution I have come across is in something other than HTML/CSS (Perl, command line, PHP) and I'm beginning to wonder if this can be done with strictly front-end code.

3

There are 3 answers

2
Gooby On BEST ANSWER

HTML is Hyper Text Markup Language, it is purely a descriptive language which says how a given piece of text or images should be displayed. PHP seems like your best option, as this is the kind of thing it is often used for, but it isn't front-end code.

0
Quentin On

HTML isn't a programming language, so it can't help.

CSS isn't a programming language, so it can't help.

JavaScript is a programming language, but it can't access the FTP server directly.

Assuming everything in the FTP server that you care about will map onto an HTTP URL then you can use the XMLHttpRequest object to try to request the file and then check the .status property to see if it 200 OK or something else (such as 404 Not Found).

2
Marc Johnston On

Not really with HTML. You can use javascript to instantiate a WScript.shell object. From there you can get some access to the file system.

var win_app = new ActiveXObject("WScript.shell");