I am trying to upload a file to a directory and store its value in the database.I don't know what is wrong with this code.Thanks in advance for the help
The pic displays variables whn echoed .
$con=connect();
$file_name=$_FILES['file']['name'];
$file_size=$_FILES['file']['size']/1024;
$display_name=$_POST['display_name'];
$upload_dir='../uploads/docs/';
$file_temp=$_FILES['file']['tmp_name'];
$file_path=$upload_dir.$file_name;
if(move_uploaded_file($file_temp,$file_path))
{
if($con)
{
$query=mysqli_query($con,"insert into dcument_upload
values(null,'$display_name','$file_path','$file_size')");
$rr=mysqli_num_rows($query);
if($rr)
{
echo 'Uploaded';
echo $rr;
}else
{
echo "Upload failed";
}
}
else
{
die("Cannot Connect");
}
}
else
{
echo "<br>Upload Failed<br>Try Again!";
}