<?php
require('config.php');
if (!isset($_FILES['image']['tmp_name'])) {
echo "";
}else{
$file=$_FILES['image']['tmp_name'];
$image = $_FILES["image"] ["name"];
$image_name= addslashes($_FILES['image']['name']);
$size = $_FILES["image"] ["size"];
$error = $_FILES["image"] ["error"];
if ($error > 0){
die("Error uploading file! Code $error.");
}else{
if($size > 10000000) //conditions for the file
{
die("Format is not allowed or file size is too big!");
}
else
{
move_uploaded_file($_FILES["image"]["tmp_name"],"upload/" . $_FILES["image"]["name"]);
$location=$_FILES["image"]["name"];
$fname= $_POST['fullname'];
$register="INSERT INTO image (image_id,location)
values('$fname','$location')"
or die("error".mysqli_errno($db_link));
$result=mysqli_query($db_link,$register);
header('location:registation.php');
}
}
}
?>