I'm trying to upload some videos using PHP. But I can't get them into any folder. I don't get errors, so I don't know where to start.
My code:
<?php
if(isset($_FILES['files']))
{
foreach ($_FILES['files']['tmp_name'] as $key => $tmp_name) {
move_uploaded_file($tmp_name, "upload/{$_FILES['files']['name'][$key]}");
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Uploading videos</title>
</head>
<body>
<div>
<form action="" method="post" enctype="multipart/form-data">
<p>
<input type="file" name="files[]" multiple="multiple" min="1" max="9999" />
<input type="submit" value="Upload" />
</p>
</form>
</div>
</body>
</html>
I'm trying to upload, .webm, .ogv and .mp4 The files aren't that big, they're just 5MB or something. First I got this error in Apache log: POST Content-Length of 15236606 bytes exceeds the limit of 8388608. So I changed that limit from 8MB to 80MB and now that error is gone, but the files aren't uploaded yet. And there are no errors anymore. When I try to send some images, I get them. Probably there is something not handled correctly. But I don't know what.
Thanks in advance for the help ;)
Bjorn
You'll want to up the following settings:
post_max_size
upload_max_filesize
memory_limit
Also set_time_limit to something high as well.
来源:https://stackoverflow.com/questions/8402139/videos-wont-upload