EDIT Nevermind, I fixed it myself. After looking through the php.ini file a bit more, I realized I also had to increase the memory limit as well as the maximum post data size 😛 . It all works swimmingly now. I'll leave the original post below for legacy reasons.
Hey, everyone. Now that I finally got my ffmpeg problems worked out, I'm trying to create a system that allows users to upload their own videos for conversion (it's not really a YouTube clone so much as a portfolio expansion for my freelance Web design business). I've never really done much with uploading large files before now, but I seem to have hit a wall.
In my php.ini file, I've set the upload limit to 500M. In my upload form's MAX_FILE_SIZE, I've also set the limit to 500MB (that is, 500000000). It works perfectly for small files, but not for larger files.
I can successfully upload and process a 8.019MB AVI file and a 7.8MB MP4 file, but then when I try anything larger, the file is not passed to my PHP script. It's not even like it gives an error; according to print_r($_FILES), the file is just not received, and I can't figure out why.
Here's what I have (in my upload.php file):
<?php
$errors=0;
print_r($_FILES);
if (isset($_POST['sub']) && isset($_FILES['fname']) && isset($_FILES['fname']['tmp_name']) && is_uploaded_file($_FILES['fname']['tmp_name'])) {
set_time_limit(600);
$oname=$_FILES['fname']['name'];
$ext=strrchr($oname, ".");
$n=uniqid("uiPdV-");
while (file_exists("Videos/Unprocessed/".$n.$ext)) {
$n=uniqid("uiPdV-");
}
$attempt=move_uploaded_file($_FILES['fname']['tmp_name'], "Videos/Unprocessed/".$n.$ext);
if ($attempt) {
header("Location: convertVideo?video=".$n.$ext);
}
else { $errors+=2; }
}
else { $errors+=1; }
if ($errors>0) {
?>
<?php if ($errors & 2) { echo "<b>Coudn't Upload</b><br/>"; } ?>
<form enctype="multipart/form-data" method="POST" action="upload.php">
<input type='hidden' name='MAX_FILE_SIZE' value='500000000' />
<input type='file' name='fname' /><br />
<input type='submit' name='sub' value='Upload & Convert' />
</form>
<?php } ?>
Like I said, the print_r($_FILES) at the top is telling me the files array is empty when I try a larger file, and I can't figure out why.
And yes, I restarted my server after changing the size limit value in php.ini.
Any idea if there's another aspect that's limiting the size? And a way around it? Most videos are larger than 10MB, so telling my clients "your users will be limited to tiny, short videos" isn't really an option.
-IMP 😉 🙂