query($sqla); if (!$resulta->num_rows > 0) { $gallery = 'stall_images/'.$randomString; mkdir($gallery); $target_dir = "stall_logos/"; $target_file = $target_dir . basename($_FILES["logo_img"]["name"]); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); // Check if image file is a actual image or fake image $check = getimagesize($_FILES["logo_img"]["tmp_name"]); if($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } // Check if file already exists if (file_exists($target_file)) { echo "Sorry, file already exists."; $uploadOk = 0; } // Allow certain file formats if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" ) { echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; // if everything is ok, try to upload file } else { if (move_uploaded_file($_FILES["logo_img"]["tmp_name"], $target_file)) { echo "The file ". basename( $_FILES["logo_img"]["name"]). " has been uploaded."; } else { echo "Sorry, there was an error uploading your file."; } } mysqli_query($conn,"INSERT INTO `stalls` (`stall_id`, `stall_owner_id`, `stall_name`, `stall_address_1`, `stall_address_2`, `stall_city`, `stall_postcode`, `stall_email`, `stall_number`, `stall_logo`, `stall_img`, `stall_desc`, `stall_category`, `stall_services`, `view_count`, `exp_date`) VALUES ('$randomString','$user_id','$stall_name','$address1','$address2','$city','$postcode','$stall_email','$stall_number','$target_file','$gallery','$desc','$category','$services','0','0000-00-00')"); foreach($_FILES["files"]["tmp_name"] as $key=>$tmp_name) { $file_name=$_FILES["files"]["name"][$key]; $file_tmp=$_FILES["files"]["tmp_name"][$key]; $filename=basename($file_name); $newFileName=time().$filename; move_uploaded_file($file_tmp=$_FILES["files"]["tmp_name"][$key],$gallery."/".$newFileName); } $search = false; // change the flag so the while loop will not repeat } } header('Location: dashboard.php#listing'); } ?> Online Market Stalls

Add Your Stall

Select Category

Name & Description

Logo/Stall Image

Add Other Images

Stall Contact information

Location