PHP上传的文件类型问题

时间:2017-04-10 13:45:00

标签: javascript php html pdo

我想上传文件,格式为skuTF.getText() :)但是当我点击上传按钮时,他正在上传每种类型的文件类型:)并保存为文件格式,如“.file”并调用mp4,webm,ogg ..如何只上传mp4,web或ogg格式.. :)以下是我的代码:

"Sucessfully uploaded"

..没有任何sytax问题,只有错误是<main> <form action="" method="post" enctype="multipart/form-data"> <input type="file" name="file"></input> <input type="submit" value="Upload"></input> </form> <?php $maxsize = 800000000; $fileformat = substr(@$_FILES["file"]["name"],4,-4); $filename = rand(0,99999999).$fileformat; $filepath = "uploaded/".$filename; if (@$_FILES["file"]["size"]>$maxsize) { echo "maximum upload size is 800MB"; } else { $d = @$_FILES["file"]["type"]; if ($d=="video/mp4" || $d=="video/webm" || $d="video/ogg"){ if (is_uploaded_file(@$_FILES["file"]["tmp_name"])) { $move = move_uploaded_file($_FILES["file"]["tmp_name"],$filepath); if ($move) {echo "succesfully uploaded";} else {echo "upload error";} } } else {echo "Supported video formats are mp4, webm and ogg";} } ?> </main> 这应该是正常的错误因为我没有选择文件......

0 个答案:

没有答案