Reputation: 206
I have a simple script for uploading video. it works fine with 16mb of file but larger file than that are not being uploaded. I'm using it on xampp localhost.
I have tried changing value on post_max_size and upload_max_size but it doesn' t work.
While uploading large file nothing happens the code does not execute If part neither else. Please see code below:
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
}
}
Thanks and hope someone will help me figure out from this problem.
Upvotes: 1
Views: 2492
Reputation: 756
check your php.ini files, you should have 2, one for CLI another for apache (if that is your stack). Judging by your question you edited just one php.ini file. Edit them both to suit your needs. The value you should edit is:
upload_max_filesize = 10M
Change to whatever you need. Also, this setting might interest you:
Maximum number of files that can be uploaded via a single request
max_file_uploads = 20
Restart apache after editing.
Upvotes: 2