Reputation: 1797
I am making a site that allows users to upload any media files they want (images, videos and audio files). However it seems to be pretty random what the page actually allows me to upload. The form is in HTML
and the recieveFile script is in PHP
.
My HTML form looks like this:
<form action="recieveFile.php?id=0" method="POST" enctype="multipart/form-data">
<input type="file" name="media" value="Choose file"/>
<br/><input type="submit" value="Upload"/>
</form>
My PHP Recieve script looks like this:
if (isset($_FILES['media']))
{
saveFileFunctions();
}
else
{
echo "No media files were uploaded!";
}
As it is per now I end up in the saveFileFunctions every time I upload an image. It also works with .txt and .pdf. However whenever I tried .mov or .mp4 files it takes me straight to the last echo as if the $_FILES['media']
is empty. Anyone have any idea why my form only seems send certain files?
Upvotes: 0
Views: 107
Reputation: 7572
You are propobly exceeding the maximum filesize allowed to upload files. You need to change that in php.ini:
; Maximum allowed size for uploaded files.
upload_max_filesize = 20M
; Must be greater than or equal to upload_max_filesize
post_max_size = 20M
You can also do that at runtime in your program
ini_set('post_max_size', '20M');
ini_set('upload_max_filesize', '20M');
Or in a .htaccess file:
php_value upload_max_filesize 20M
php_value post_max_size 20M
Upvotes: 1