I am working on a simple upload script. The thing is that when I upload an image file it is easily uploaded on the server and its data is written in my database but when I try to upload video files like mp4, and audio mp3 file, the server gives me this error.
https://i.stack.imgur.com/FCq2c.png
Here is my upload.php code.
<?php
include('config.php');
function bytesToSize1024($bytes, $precision = 2) {
$unit = array('B','KB','MB');
return @round($bytes / pow(1024, ($i = floor(log($bytes, 1024)))), $precision).' '.$unit[$i];
}
$FileName = $_FILES['filename']['name'];
$FileType = $_FILES['filename']['type'];
$FileSize = bytesToSize1024($_FILES['filename']['size'], 1);
$Fileid = uniqid(rand());
$query2 = "INSERT INTO files (id, name, size, type) VALUES ('$Fileid', '$FileName', '$FileSize '$FileType')";
$result2 = mysql_query($query2);
echo <<<EOF
<p>Your file: {$FileName} has been successfully received.</p>
<p>Type: {$FileType}</p>
<p>Size: {$FileSize}</p>
EOF;
Here is my index.html code
<form action="upload.php" method="post" enctype="multipart/form-data">
<center><p> <input type='file' size='58' style='height: 30px; font-size: 18px' name='filename'></p>
<input type="submit" name="submit" value="Upload">
</form>