我有一个简单的上传视频脚本。它可以正常使用16mb的文件,但文件大于未上传的文件。我在xampp localhost上使用它。
我尝试在post_max_size和upload_max_size上更改值,但它没有' 工作。
上传大文件时没有任何反应,代码不会执行。如果不是其他部分。请参阅以下代码:
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
}
}
谢谢,希望有人能帮我解决这个问题。
答案 0 :(得分:1)
检查你的php.ini文件,你应该有2个,一个用于CLI另一个用于apache(如果那是你的堆栈)。根据您的问题判断您只编辑了一个php.ini文件。编辑它们以满足您的需求。您应该编辑的值是:
<div class = "form-group">
<label for = "title" class = "control-label">Title:</label>
<input type = "text" name = "title" class = "form-control" value = "{{ $documentLists->title }}">
</div>
<div class = "form-group">
<label for = "category" class = "control-label">Category:</label>
<input type = "text" name = "category" class = "form-control" value = "{{ $documentLists->category_type }}">
</div>
<div class = "form-group">
<textarea id = "content">{{ $documentLists->content }}</textarea>
</div>
改变你需要的东西。此外,此设置可能会让您感兴趣:
upload_max_filesize = 10M
编辑后重启apache。