<?php
ob_start();
$mysql_host = "localhost";
$mysql_user = "root";
$mysql_pass = "";
$mysl_database = "login";
$conn = mysql_connect($mysql_host, $mysql_user, $mysql_pass);
$db_select=mysql_select_db($mysl_database, $conn);
if($conn==false ||$db_select==false)
{
die("connection error");
}
if(!isset($_SESSION["email"]))
{
session_start();
}
$location="profilepics/";
$name=$_FILES['myimage']['name'];
$temp_name=$_FILES['myimage']['tmp_name'];
if((isset($name)))
{
move_uploaded_file($temp_name,$location.$name);
}
?>
I am getting this error while the page gets reload or directed towards it
Notice: Undefined index: myimage in C:\xampp\htdocs\profilepic.php on line 21
Notice: Undefined index: myimage in C:\xampp\htdocs\profilepic.php on line 22
but as soon as file is uploaded errors disappear please help.below is my html code
<form method="post" enctype="multipart/form-data" action="profilepic.php">
<div id="box_title"><span class="glyphicon glyphicon-user"></span> <strong>I look like this: </strong></div>
<div class="pull-right"><img src="<?php $target_file ?>" height="150px" width="200px"/></div><br />
<div class="form-group">
<label for="exampleInputFile">select a picture</label>
<input type="file" id="exampleInputFile" name="myimage" />
<p class="help-block">upload your photo</p>
</div>
<button type="submit" class="btn btn-info">upload</button>
<br />
</form>