Shooting from the hip here, I guess I need to access value 0 to 4 in the $_FILES array and increment the query values by 1 on the $_FILES array each time it loops to get the right values, however that might not be the right logic.
How are you naming the file-type input elements in your form?
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
You can give them all the same name with a "[]" at the end, which will create a sub-array within PHP.
Code:
<input type="file" name="userfile[]" />
Then you can loop through them as:
PHP Code:
foreach ($_FILES["userfile"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { // do your move_uploaded_file(), etc. here with // $_FILES['userfile']['tmp_name'][$key], $_FILES['userfile']['name'][$key], etc.... } else { // echo error or whatever here if you want for failed upload } }
Last edited by NogDog; 12-23-2008 at 11:31 PM.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
You copied-and-pasted my code before I edited it to fix the copy-and-paste error I had in it. $_FILES['picture'] should have been $_FILES['userfile'] (or whatever you want to name the field in the form).
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Noggin seems to be recovering well from the surgery, thank you. Tomorrow (well, today, now) I'll probably find out if it was malignant or benign, which will then determine whether or not I have a merry Christmas.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
In regards to this, everything is going almost 100% now, except from the query is a little bugged.
Its coming back with a duplicate entry error, which makes me think its not taking the incremented values when entering the var values to the db at each itteration.
Just a quick follow-up on Noggin: the lab results are in and the verdict is "benign," so now I can actually enjoy the holidays.
Thanks for you concern and support.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks