【翻译】Video Upload MIME types(视频上传MIME类型)

From [url]http://www.htmlforums.com/php-programming/t-video-upload-mime-types-105680.html[/url]


if(isset($_POST['submit']) && $_POST['submit'] == 'Submit') //if form has been submitted
{
//for now:

if ($_FILES["file"]["error"] > 0)
{
//echo "Error: " . $_FILES["file"]["error"] . "
";
}
else
{
if ((($_FILES["file"]["type"] == "video/x-msvideo") //.avi
|| ($_FILES["file"]["type"] == "video/quicktime") //quicktime
|| ($_FILES["file"]["type"] == "video/x-ms-asf")
|| ($_FILES["file"]["type"] == "video/mp4")
|| ($_FILES["file"]["type"] == "audio/x-ms-wmv")
|| ($_FILES["file"]["type"] == "video/x-ms-wmv")
|| ($_FILES["file"]["type"] == "video/mpeg"))
&& ($_FILES["file"]["size"] < 10000000))
{
echo "Upload: " . $_FILES["file"]["name"] . "
";
echo "Type: " . $_FILES["file"]["type"] . "
";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
if (move_uploaded_file($_FILES["file"]["tmp_name"],"/tmp/".$_FILES["file"]["name"])) {
echo "file moved";
include "putfile.php";
} else {
echo "move failed";
}
} else {
echo "wrong type of file please try again....";
}
}


用以上代码无法上传 .wmv 和 .avi 文件,不知何故?

你可能感兴趣的:(PHP)