I'm using a goDaddy server and cPanel to make a website, and I want to make a feature that lets users upload videos, save them on the server, then display them elsewhere on the site.
echo "<iframe src='uploads/videos/sample.mov' frameborder='0' allowfullscreen></iframe>";
How can i get video formats like .mov to play on the site after they are uploaded on the server?
We’re currently able to get mp4 to work with the below code, but I don’t want to limit users to only upload mp4
if(isset($_FILES["submit_file"])){ //this comes from an html form
$name = $_FILES['submit_file']['name'];
$original_name = $name;
$size = $_FILES['submit_file']['size'];
$tmp_name = $_FILES['submit_file']['tmp_name'];
$target_dir = null;
$finfo = finfo_open(FILEINFO_MIME_TYPE);//get mime type
$mime = finfo_file($finfo, $tmp_name);
if ($mime == "video/mp4" || $mime == "video/wmv" || $mime == "video/avi" || $mime == "video/mov")
{
$target_dir = "uploads/videos/";
$path = $target_dir . basename($name);
if (move_uploaded_file($tmp_name, $path) == true) {
//moved
}
}else{
//error: Unsupported File Type;
}
}
How do sites like facebook allow uploading videos other than mp4? I looked into using FFmpeg to convert everything to mp4, but I don't see how to install and use that on the godaddy server.