如何添加只接受mp4?
<?php
if(isset($_POST['submit']))
{
$name = $_FILES['file']['name'];
$temp = $_FILES['file']['tmp_name'];
move_uploaded_file($temp,"uploaded/".$name);
$url = "/uploaded/$name";
$db->query("INSERT INTO `videos` VALUES ('','$name','$url')");
$query = $db->query("SELECT * FROM videos WHERE name = '".$name."'");
$row = $query->fetch_assoc();
echo "<center>Your upload is created <a href='watch.php?id=".$row['id']. "' target='blank_'>CLICK</a></center>";
}
?>
你可以用正确的PHP脚本重新发布php
答案 0 :(得分:0)
这也是一种方式。
$filetype = $_FILES['file']['type'];
if ($filetype != 'video/mp4') {
exit('Stop, wrong file!);
}