Hi Can anyone tell me how to restict user from uploading the video files of large size and they should upload only specific type. They should be able to upload only 8mb files and not more than that. Below is my code.
<?php
if(isset($_POST['submit']))
{
$filename=$_FILES['file']['name'];
$filesize=$_FILES['file']['size'];
$filetype=$_FILES['file']['type'];
$tmpfile=$_FILES['file']['tmp_name'];
$unique=str_shuffle("abcde").$filename;
if ((($filetype == "video/avi")
|| ($filetype == "video/mpeg")
|| ($filetype == "video/mpg")
|| ($filetype == "video/mov")|| ($filetype == "video/wmv") || ($filetype == "video/rm") || ($filetype == "image/mp4"))
&& ($filesize < 8388608 and $filesize > 20))
{
move_uploaded_file($tmpfile,"uploads/$unique");
echo'file is uploaded';
}
else
{
echo'failure in uploading';
}
}
?>