I have a form with an file field for images, a select option to choose album name, and a text field to type in a title.
I then loop this so it output 25 different rows which each of those 3 fields. The corresponding field names are upload[], album[] and title[].
Once the form is processed, it goes through all of the array indexes where there was a valid image, and completes all the corresponding thumbnail and resizing code and puts it into a database.
I just do not know how I can get all the album's and title's that correspond with the files to cycle through as well. I need those for when I insert a valid image path into the database.
Here is my processing code so far.
$upload = $_POST['upload'];
$title = $_POST['title'];
$album = $_POST['album'];
foreach($_FILES['upload'] as $file)
{
list($width, $length) = getimagesize($_FILES['upload']['tmp_name']);
if ($width > 3000 || $length > 3000)
{
$errors = 1;
$error .= "* One or more of your files dimensions are too large. (Must be less than 3000 x 3000) *";
}
$getimagesize = getimagesize($_FILES['upload']['tmp_name']);
if ($getimagesize != true)
{
$errors = 1;
$error .= "* You have uploaded one or more files that are not images. (Images must be either .jpg, .jpeg, .gif or .png) *";
}
if($errors == 0)
{
$target = 'images/';
$target = $target ."/". basename($_SESSION['username'].'_'.$_FILES['upload']['name']) ;
$target = str_replace( " ", "_", $target );
if ( ($_FILES['upload']['type'] == "image/jpeg") || ($_FILES['upload']['type'] == "image/jpg") || ($_FILES['upload']['type'] == "image/gif") || ($_FILES['upload']['type'] == "image/png") || ($extension == "jpeg") || ($extension == "jpg") || ($_FILES['upload']['type'] == "image/pjpeg"))
{
if ($_FILES['upload']['size'] < 3000000)
{
if (is_uploaded_file($_FILES['upload']['tmp_name']))
{
//Here I want to then move the file to a folder which I know how to do move_uploaded_file and then I need to somehow get the corresponding title and album with this image to put into a database.
Any Ideas?