281
« on: November 25, 2012, 05:19:38 pm »
When I use this I'm not getting anything as output. I get a blank page when trying to upload an avi file
<?php
$allowedExts = array('mp4','wmv','avi','flv'/*all allowed exts go here*/);
$extension = end(explode(".", $_FILES["file"]["name"]));
if (($_FILES["file"]["size"] < 10485760 /* file size*/) && in_array($extension, $allowedExts))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
$random_digit=rand(0000,9999);
$pathnew = $random_digit . $_FILES["file"]["name"];
echo "Uploaded file name: " . $pathnew . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
$path=random_digit;
if (file_exists("/home/omni/uploads" . $path . "/" . $pathnew))
{
$lol = 0;
while ($lol === 0)
{
$random_digit=rand(0000,9999);
$pathnew = $random_digit . $_FILES["file"]["name"];
$path = $random_digit;
if (file_exists("/home/omni/uploads" . $path . "/" . $pathnew))
{
$lol = 0;
}
else
{
$lol = 1;
}
}
}
else
{
mkdir($path);
move_uploaded_file($_FILES["file"]["tmp_name"],
"/home/omni/uploads" . $path . "/" . $pathnew);
}
}
}
else
{
echo "Invalid file";
}
?>
Did I do something wrong?