Ars Informatica
September 28, 2020
Health Care Informatics
Web-based MySQL/PHP Databasing
Web Development
Favourite Software
Hardware for the Frugal Fanatic
Graphic Design and Image Processing
Free Scripts and Software
About Us
Contact Us

 Article Feed for this site

Using PHP to read and sort a file directory

January 14, 2009

So you want to display the contents of a directory on your server. PHP can do it. You've already built something like it - but it's not drag-and-drop code. Which is a shame, really, because it's pretty basic functionality, and not hard to do ...

Anyways, here's a few little code snippets you can use. The longest of these (24 lines) allows you to sort by file name, file size, type of file, or date last modified. Sort direction can be specified - small to larger, older to more recent, etc.


Unique file names for uploaded files using PHP

August 28, 2008

Web page file uploads are very useful - custom front ends, absolute simplicity for end users, control over file types uploaded. But you'll need to guard against overwriting existing files when a file with the same name is submitted.

This four-line! PHP scriptlet creates a new file name from the original, appending an underscore and new, unique, sequentially incrementing number as required.

I also step through the code, bit by little bit - a neat little introduction to Regular Expression matching, if you're interested.

How-to Rollover Images - CSS, Flash, and Javascript

August 25, 2008

Rollovers are images that change appearance when the mouse moves over them: slick and functional cues that this, indeed, is an active link, and it'll take you somewhere.

Rollover images can be coded in CSS, Flash, or Javascript. Which should you use? We present the pros and cons for each method, then tell you why we think you should use Javascript. (Hint: the CSS method causes artifacting in Internet Explorer, and Flash is frequently not supported.)

Finally, we present a very few lines of code - easy to modify, and we tell you how. It works, in all the browsers we've tested it on. See it in action.

[ Read more ... ]

[ Prev ][ Next ]
Copyright © 2020 Ars Informatica. All Rights Reserved.