I have written below lines of code
<?php
$uniqId = uniqid('file_');
$root = $_REQUEST['root'];
$target_file = "uploads/".basename($_FILES["file"]["name"]);
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
if ( 0 < $_FILES['file']['error'] )
{
echo 'Error';
}
else if ($_FILES["file"]["size"] > 2097152)
{
echo "SizeError";
}
else if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "docx" && $imageFileType != "pdf")
{
echo "ExtensionError";
}
else
{
if( move_uploaded_file($_FILES['file']['tmp_name'], $root.$uniqId.".".$imageFileType))
{
echo $uniqId.".".$imageFileType;
}
}
?>
If I upload 5 mb file, the code is jumped to simple "Error" condition. I want that it should display SizeError. Please help!!!