This is my code and I want to upload images along with other info like email password etc. but it is not working.
<?php
$target_dir = "uploads/";
include("include/connect.php");
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
if($check !== false) {
echo "File is an image - " . $check["mime"] . ".";
$uploadOk = 1;
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
$repassword = $_POST['repassword'];
$sql="INSERT INTO student ('name', 'email', 'password','repassword','pic')
VALUES ('name' , 'email' ,'password' ,'repassword' ,'pic')";
$res=mysqli_query($con,$sql);
var_dump($res);
} else {
echo "File is not an image.";
$uploadOk = 0;
}
}
?>
This is my code and it is not working.
Edit
<form action="upload.php" enctype="multipart/form-data" id="insert" method="post" name="insert">
USERNAME:<input name="name" type="text" value=""><br>
EMAIL-ID:<input name="email" type="text" value=""><br>
PASSWORD:<input name="password" type="password" value=""><br>
RE-PASSWORD:<input name="repassword" type="password" value=""><br>
<br>
<input id="fileToUpload" name="fileToUpload" type="file"><br>
<input name="hdn" type="hidden" value="hdn"><br>
<input name="submit" type="submit" value="submit"><br>
</form>
– Uthman Apr 14 '15 at 09:57