我有一個簡單的腳本來上傳視頻。它可以很好地處理16mb的文件,但文件比沒有上傳的文件大。我在xampp localhost上使用它。不能上傳大文件
我試過改變post_max_size和upload_max_size上的值,但它沒有' t工作。
上傳大文件時,什麼也沒有發生,代碼不執行如果其他部分都沒有。請看下面的代碼:
if(isset($_POST['upload_btn']))
{
$q3="select uid from user_profile where username='$uname'";
$row=mysql_fetch_assoc(mysql_query($q3));
$id=$row['uid'];
$name=$_FILES['file']['name'];
$desc=$_POST['vid_desc'];
$type_temp=$_FILES['file']['type'];
$type=substr($type_temp,-3);
$size=$_FILES['file']['size']/1024/1024;
$temp=$_FILES['file']['tmp_name'];
if($_POST['vid_title']=="")
{
$name=$_FILES['file']['name'];
}
else
{
$_FILES['file']['name']=$_POST['vid_title'];
$name=$_FILES['file']['name'].".".$type;
}
if($_FILES['file']['type']=="video/mp4"||$_FILES['file']['type']=="video/flv"||$_FILES['file']['type']=="video/avi"&&$_FILES['file']['size']>=0)
{
$row=mysql_fetch_assoc(mysql_query("select uid from user_profile where username='$uname'"));
$uid=$row['uid'];
$query="insert into video_info(vid_title,vid_desc,vid_type,vid_size,uid) values('$name','$desc','$type','$size',$uid)";
mysql_query($query);
move_uploaded_file($temp,"videos/".$name);
?>
<script type="text/javascript">
document.getElementById("success").innerHTML = "Video uploaded successfully!!!";
//alert("Video uploaded successfully!!!");</script>
<?php
}
else
{
?>
<script type="text/javascript">
document.getElementById("error").innerHTML = "<style='color:red;'>Format not supported!! Supported formats are .mp4, .flv, .avi";
//alert("");</script>
<?php
}
}
謝謝,希望有人能幫我弄清楚這個問題。
然後檢查錯誤代碼。 –
兩個錯誤代碼都未被執行。 –
'document.getElementById(「error」)'這不是我說的,我的意思是這個http://php.net/manual/en/features.file-upload.errors.php –