View Full Version : generating html files from image files in a directory

07-12-2004, 07:28 AM
hi. my mom wants a site where she and other family members (in other states) can upload images of events, distant relations, etc. with comments, and some kind of search and/or sort functionality. i suspect this is probably an application that asp or php would be best suited for - but i really just can't afford to spend the kind of time learning one of those would require. i'm trying to come up with a simple, quick method and all i'm coming up with is something like an html form with upload dialogue, user picks a directory from list. (i think i got this part covered). after that, many questions arise:

is it possible for js to create a new document (a .html file)? as far as i know, only server-side languages can do this, but i really have no idea... any direction here would be helpful, but if possible it would be great to have onsubmit, a js function to create (duplicate?) an .html file with precanned code (just html, body, and img tags) with the src of the img set to the filename of the jpg that was just uploaded. if not, maybe i could pregenerate a thousand .html files and have javascript rename them and change the one line of img src?

then finally, a function that creates an array of all the files in each of those user-accessible directories and makes a link for each, maybe somethig like:

txtOutput += '<a href="'+filename+' + '.html'">'+filename+'<a>';
document.getElementById('somefiles').innerHTML = txtOutput;

but i don't even know how to really apply that and i suspect i'm making that part more difficult than it needs to be...

so.. any suggestions at all, or scraps of script, or links to a precanned solution, whatever, is helpful since ive got nothin goin. i did try a couple php message boards (where i've seen folks upload images, thought maybe i could adapt it), but had no luck when trying to install them serverside...


07-12-2004, 08:09 AM
I'd go back to PHP w/MySQL db, using PHPmyAdmin.

There are lots of free canned scripts available for doing what you want.


07-12-2004, 08:52 AM
thx for the reply... can you (or anyone) point me in the right direction? a link would be terrific... and once i've got the code, what needs to happen serverside? last failed attempt returned server-generated errors of "your database selection doesn't match the configuration on your server" or "cannot open (connect?) to database" - i tried with a msaccess.php, mysql.php for 3 and 4, and nothing caught... anything about permissions, directory structure, etc et al i should know?

thx again.