if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") { $error .= "Sorry, only JPG, JPEG, PNG & GIF files are allowed."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { $error .= "Sorry, your file was not uploaded."; // if everything is ok, try to upload file } else { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { } else { $error .= "Sorry, there was an error uploading your file."; } } if (!empty($name) && !empty($price) && !empty($description) && !empty($quantity)) { $admin->addProduct($name, $price, $description, $category_id, $quantity, $target_file); $error = "Successfully added:::add more"; } else { $error = "Please fill all the texts in the fields"; } } ?> <div class="container"> <div class="main" style="margin-top: 10px;"> <form action="admin_product_add.php" method="post" class="smart-green" enctype="multipart/form-data"> <h1>Add Product <span><?php echo $error; ?> </span>