我已经编写了用于上传任何文件的代码,并且还应用了某些限制。但是现在当我尝试上传任何视频时,它没有显示任何错误,它只是显示一个空白屏幕。我已经为图像写了它。我对为别人写什么感到困惑。我的代码如下
<?php
session_start();
define ("MAX_SIZE","4000");
define ("WIDTH","750");
define ("HEIGHT","563");
function getExtension($str)
{
$i = strrpos($str,".");
if (!$i)
{
return "";
}
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
$errors=0;
if(isset($_POST['Upload']))
{
$image=$_FILES['image']['name'];
if ($image)
{
$filename = stripslashes($_FILES['image']['name']);
$extension = getExtension($filename);
$extension = strtolower($extension);
$size=getimagesize($_FILES['image']['tmp_name']);
$sizekb=filesize($_FILES['image']['tmp_name']);
if ($sizekb > MAX_SIZE*1024)
{
echo '<h1>You have exceeded the size limit!</h1>';
$errors=1;
}
$image_n=time();
$image_name=$image_n.'.'.$extension;
//$image_name1="vimal".$extension;
echo "<br> Image Name " . $image_name;
echo "<br> " . $_SESSION['Id'];
$newname=$_SESSION['Id'] ."/upload/".$image_name;
$copied = copy($_FILES['image']['tmp_name'], $newname);
//$copied1 = copy($_FILES['image']['tmp_name'], $image_name1);
if (!$copied)
{
echo '<h1>Copy unsuccessfull!</h1>';
$errors=1;
}
else
{
echo "Your databaase Insert Code Here";
include ("config.php");
$st = "insert into file_master values('".$_SESSION['Id'].$image_n ."','" . $extension . "','".$image_name."','".$_SESSION['Id'] ."/upload/".$image_name. "','".$_SESSION['Id']."','N')" ;
echo "<br>". $st;
try
{
mysql_query($st);
}
catch(Exception $e)
{
echo $e->getMessage();
}
}
}
}
}
}