I am trying to upload an image to be stored in a database on mysql however I keep receiving an error:
Notice: Undefined index: profilepic in >[php-path]/tuto>rsignupsubmit.php on line 17
There is a simple button upload of type file on a form:
<div class="field">
<label>Profile Picture</label>
<input class="button" type="file" name="profilepic">
</div>
I then have this code on another submit page, I am quite new to PHP however I have searched and searched and cannot find a solution anywhere.
//File upload
$target_dir = "../img/";
$newprofilepic = $target_dir . basename($_FILES ["profilepic"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($newprofilepic,PATHINFO_EXTENSION));
$newlocation = mysqli_real_escape_string($conn,$_POST['location']);
$insertquery = "INSERT INTO tutors(name, username, password, email, mobile,
profilepic, location,
message)"."VALUES('$newname','$newusername','$newpassword','$newemail',
'$newmobile', '$newprofilepic', '$newlocation', '$newmessage')";
$result = mysqli_query($conn, $insertquery) or die(mysqli_error($conn));
mysqli_close($conn);
Thanks in advance.