class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
I don't see how this class will $_POST my "input type="text" name="image1" and associate it as a key value pair with my "input type="file" size="32" name="my_field[]" value="" >".
(I've removed the <> from this post so to escape browser recognition)
I've unsuccessfully used the following code in my form: form name="form3" enctype="multipart/form-data" method="post" action="upload.php" input type="file" size="32" name="my_field[]" value="" /> input type="text" name="image1"> input type="file" size="32" name="my_field[]" value="" /> input type="text" name="image2"> input type="file" size="32" name="my_field[]" value="" /> input type="text" name="image3"> input type="hidden" name="action" value="multiple" /> input type="submit" name="Submit" value="upload" /> /form
The images upload flawlessly, but the text is lost.
Can the global post and differentiate both types if I give them both the same name? name="my_field[]"
I fully understand the 'foreach' code below, I just don't see where the class will POST the different "type" values from my form then associate them.
$files = array();
foreach ($_FILES['my_field'] as $k => $l) {
foreach ($l as $i => $v) {
if (!array_key_exists($i, $files))
$files[$i] = array();
$files[$i][$k] = $v;
}
}
and associate it as a key value pair with my "input type="file" size="32" name="my_field[]" value="" >".
(I've removed the <> from this post so to escape browser recognition)
I've unsuccessfully used the following code in my form:
form name="form3" enctype="multipart/form-data" method="post" action="upload.php"
input type="file" size="32" name="my_field[]" value="" />
input type="text" name="image1">
input type="file" size="32" name="my_field[]" value="" />
input type="text" name="image2">
input type="file" size="32" name="my_field[]" value="" />
input type="text" name="image3">
input type="hidden" name="action" value="multiple" />
input type="submit" name="Submit" value="upload" />
/form
The images upload flawlessly, but the text is lost.
Can the global post and differentiate both types if I give them both the same
name? name="my_field[]"
I fully understand the 'foreach' code below, I just don't see where the class
will POST the different "type" values from my form then associate them.
Simply use the original file name passed thru the global as text name.
No need for secondary textarea form input.