Please can someone assist me to, I've got a form where customers can upload as much as 7 images. When submit is pressed the file and user particulars is posted towards the database, along with a folder is produced,in which the image is going to be gone to live in. The consumer can get a mistake message when the image has ended 200kb or maybe it is not a jpeg/presen or maybe he didn't choose any images to upload striking the submit button, I'm getting the issue once the user decides he only really wants to submit one image, not every seven, because We used a for loop the mistake is produced even if the consumer uploads one picture, which isn't things i want, the consumer do not have to upload all seven pictures he is able to choose just how much as many as seven? How do you fix this?

Here's my code:

if (isset($_POST['submit'])) 
     $ref_49 = $_POST['ref_49'];
     $name = $_POST['name'];
     $contact = $_POST['contact'];
     $email = $_POST['email'];
     $rent_sell = $_POST['rent_sell'];
     $heading = $_POST['heading'];
     $price = $_POST['price'];
     $limitedtextarea = $_POST['limitedtextarea'];
     $type = $_POST['type'];
     $where = $_POST['where'];
     $address = $_POST['address'];
     $bedroom = $_POST['bedroom'];
     $bathroom = $_POST['bathroom'];
     $garages = $_POST['garages'];
     $carports = $_POST['carports'];
     $granny_flat = $_POST['granny_flat'];
     $ref_99 = $_POST['ref_99'];
     $fulldesc = $_POST['full_desc'];


     $todays_date = date("Y-m-d");

     mkdir("gallery/" . $_POST["name"], 0777);

          for($i = 0; $i < 7; $i++)
              $file_name = $_FILES['uploadFile'. $i]['name'];
              // strip file_name of slashes
              $file_name = stripslashes($file_name);
              $file_name = str_replace("'","",$file_name);

              if ((($_FILES['uploadFile'. $i]["type"] == "image/gif")
              || ($_FILES['uploadFile'. $i]["type"] == "image/jpeg")
              || ($_FILES['uploadFile'. $i]["type"] == "image/pjpeg"))
              && ($_FILES['uploadFile'. $i]["size"] < 200000))

                     if ($_FILES['uploadFile'. $i]["error"] > 0)
                           $message = "Return Code: " . $_FILES['uploadFile'. $i]    ["error"] . "<br />";
                           $query = "INSERT INTO property (
                                                          name, contact, email,  type_of_listing, rent_sell, address, prop_desc, area, price, main_image, image_1, image_2, image_3, image_4, image_5, image_6, heading, bathroom, bedroom, garages, carports, granny_flat, full_description, full_ad, 49_ref, 99_ref, listed
                                                         ) VALUES (
                                                          '{$name}', '{$contact}', '{$email}', '{$type}', '{$rent_sell}', '{$address}', '{$limitedtextarea}', '{$where}', '{$price}', '{$photo_1}', '{$photo_2}', '{$photo_3}', '{$photo_4}', '{$photo_5}', '{$photo_6}', '{$photo_7}', '{$heading}', '{$bathroom}', '{$bedroom}', '{$garages}', '{$carports}', '{$granny_flat}', '{$fulldesc}', '{$full_ad}', 'ref_49_{$ref_49}', 'ref_99_{$ref_99}', '{$todays_date}'

                           $result = mysql_query($query, $connection);

                           if (file_exists("gallery/" . $_POST["name"] . "/" . $_FILES['uploadFile'. $i]["name"]))
                                  $message = "<h3>" . $_FILES['uploadFile'. $i]["name"] . " already exists.</h3>";
                                  move_uploaded_file($_FILES['uploadFile'. $i]["tmp_name"], "gallery/" . $_POST["name"] . "/" .  $_FILES['uploadFile'. $i]["name"]);
                                  $message = "File: "  . $_FILES['uploadFile'. $i]["name"] . " uploaded.";
                  $message = "<h3>Invalid file or no file selected.</h3><br />• Only JPEG OR GIF allowed.<br />• Size limited may not exceed 200KB.<br /><a href = \"local_artist.php\">Return</a>";                  //This is the error that keeps on popping up even though an image was chosen