I mentioned in Code that "Error line" that position line show this error" Notice: Undefined index: file in C:\xampp\htdocs\Lab\register2.php on line 33 ". But in my database data increased means primary key(id). And i need solve it in PHP Please help me .
<?php
if(isset($_POST['btn_upload']))
{
$fullname=$_POST["fullname"];
$file = rand(1000,100000)."-".$_FILES['file']['name']; //Error line
$file_loc = $_FILES['file']['tmp_name']; //Error line
$info = pathinfo($_FILES['file']['name']); //Error line
$ext = $info['extension']; //Error line
$newname = $userid.".".$ext; //Error line
$target = 'uploads/'.$newname;
move_uploaded_file( $_FILES['file']['tmp_name'], $target); //Error line
require_once "config.php";
$db=get_connection();
$sql="INSERT INTO user(Path) VALUES('$newname')";
mysql_query($sql);
}
?>
<!DOCTYPE html>
<html>
<title></title>
<body>
<center>
<form action="#" method ="POST">
Full Name : <input type="text" name="fullname"/><br/>
Phone : <input type="number" name="phone"/><br/>
Address :<textarea rows="4" cols="30" name="textin"></textarea><br>
Profile Picture : <input type="file" name="file" /> <button type="submit" name="btn_upload">Upload Image</button><br/>
<input type= "submit" name ="back" value="Back"/><br/>
<input type= "submit" name ="next1" value="Next"/>
</form>
</center>
</body>
</html>