/* here i have coded to upload a video file.. but it is not uploaded due to $_files['pagef']['tmp_name'] is empty */
if(isset($_POST[Upload]))
{
if($_POST[dname]=="")
{
$c=1; $m="Please Enter File Name";
}
if($_POST[dname]!="")
{
$s=mysql_query("Select * from ai_downloadfiles where dname='$_POST[dname]'");
if(mysql_num_rows($s)>0)
{
$c=1;
$msg="File Name already created..."; /*error message*/
}
}
if($_FILES['pagef']['name']!="")
{
$ext=getFileExtension($_FILES['pagef']['name']);
$fn=uniqid("").".".$ext;
if(move_uploaded_file($_FILES['pagef']['tmp_name'],"../downloadfiles/$fn"))
{
$c=0;
}
else
{
$c=1;
$msg="Cant Uploaded";
}
}
if($c==0)
{
$cur=date("Y-m-d");
$s=mysql_query("insert into ai_downloadfiles (dname,files,cdate,ctime)
values('$_POST[dname]','$fn','$cur',now())") or
die(mysql_error());
}
}
答案 0 :(得分:1)
您没有提供HTML表单代码,但由于$_FILES['pagef']['tmp_name']
为空,我猜,您忘记了enctype
参数,这是上传文件所必需的:
<form enctype="multipart/form-data" method="post">
另一个可能的原因 - 文件太大,超出了php.ini中设置的限制。寻找upload_max_filesize
和max_post_size
。默认情况下,这只是几个megs,这对于视频文件来说可能还不够。