I wand to give the user the ability to upload as many pictures as he wants to. at present I hava a fexed amount of browse fields wich the user can use to select pictures... the code looks something like this :
<?PHP $max_file_size = 3000000; ECHO "<FORM NAME=name ID=name ACTION=submit.php enctype='multipart/form-data' METHOD=post >"; ... code ... ECHO "<input type='hidden' name='MAX_FILE_SIZE' value = $max_file_size > "; ECHO "<input id='file1' type='file' name='file'><BR>"; ECHO "<input id='file2' type='file' name='file'><BR>"; ECHO "<input id='file3' type='file' name='file'><BR>"; ... code... ECHO "<BR><INPUT TYPE = submit NAME = submit VALUE = 'blah '>"; ECHO "</FORM>"; ?>
On the other page I have code that builds a unick name for each uploaded picture, then makes a directory and copies the selected pictures in that directory.
This part works properly.
Then I have a few lines of code that build the link to each of those files in part and uploads it in to a DB... the website then accesses those pics via the links wich it takes from the DB.
Now on the DB, the images have their own table... it has two main columns... "largepic" and "smallpic". smmallpic is the thumbnail and largepic is the image that is displayed when users click on the thumbnail to view the full pic.
Now I need to figure out a way in wich to submit these pictures in groups of two. and process them in solid groups of two too.
SO I was thinking maybe on the upload page only two browse buttons would be shown... when the user fills bolth of them, another two apear beneath them (I'm guessing something like this can be done with ajax scripts somehow)... maybe with building the name of each field as a string first with a numeric value as part of the name that one can increment each time a new set of fields is needed.
But how do I go about the saving of the parh to the DB? the solid groups of two links need to be identifyable somehow so that you can target them when putting the links in the db since the first field needs to point to the first column and the second needs to point to the second.
If it was a set number of fields it would be easy to just write the upload proecess for each field... but for a limitless amount of fields ( namelly a new set of fields pops up as soon as the last set is filled... and, sheesh... lots of complications, if the user delets the pics in a field in the middlle of two other sets only that set of fields has to disapear and the others realocated... I am lost... )
How do you supose I could go about this unlimited image upload procedure?