简体   繁体   English

在上传视频文件方面需要帮助

[英]Need Help Regarding Uploading Video Files

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. 问题是,当我上载图像文件时,它很容易上载到服务器上,并且其数据写入了我的数据库中,但是当我尝试上载视频文件(如mp4和音频mp3文件)时,服务器给了我这个错误。

http://i.stack.imgur.com/FCq2c.png http://i.stack.imgur.com/FCq2c.png

Here is my upload.php code. 这是我的upload.php代码。

<?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 这是我的index.html代码

<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>

Are the video files more then the max upload filesize of 2 Mb (default). 视频文件是否大于2 Mb(默认)的最大上传文件大小? PHP change the maximum upload file size PHP更改最大上传文件大小

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM