With php file like below to upload video files from local drive to the application that I'm currently developping, (before being played at html, so html coding has nothing to do with it.) I can successfully upload mp4, mov, flv, and avi, but I can not upload wmv, mpg, and asf with messages saying "the mime type is not found on this list" which comes from this php file and I made this message by myself.
So, it is happening within this php file, before the browser(html file) recognizes what kind of file it is.
~~~~~~~
$mimetype = mime_content_type($path);
switch ($mimetype) {
case "video/mp4":
if($header){
header("Content-Type: video/mp4");
$dst_im = copy($path, $dst_file);
return "";
}else{
$dst_file = $dst_file . ".mp4";
if($re_size[0] == $size[0] && $re_size[1] == $size[1]) {
copy($path, $dst_file);
} else {
$dst_im = copy($path, $dst_file);
}
}
unlink($dst_im);
break;
case "video/x-ms-wmv":
if($header){
header("Content-Type: video/x-ms-wmv");
$dst_im = copy($path, $dst_file);
return "";
}else{
$dst_file = $dst_file . ".wmv";
if($re_size[0] == $size[0] && $re_size[1] == $size[1]) {
copy($path, $dst_file);
} else {
$dst_im = copy($path, $dst_file);
}
}
unlink($dst_im);
break;
case "video/quicktime":
case "video/x-msvideo":
case "video/x-flv":
case "video/mpeg":
case "video/x-ms-asf":
default:
return array(0, "* the mime type is not found on this list.");
}
return array(1, $dst_file);
}
~~~~~~~
ext. mime result origin of file
mp4 video/mp4 uploaded Shot with my smartphone
mov video/quicktime uploaded Shot with my smartphone
avi video/x-msvideo uploaded Shot with my camera
flv video/x-flv uploaded Downloaded from web
wmv video/x-ms-wmv can't be uploaded Downloaded from web
mpg video/mpeg can't be uploaded Downloaded from web
asf video/x-ms-asf can't be uploaded Downloaded from web
I also have made proper .htaccess setting.
I think that,
*The html coding is not issue here.
*The browser type is not issue here.
*The coding of php file is not issue here, because some are uploaded with the same php file and there're no indication of mime type and file extension other than this php file.
*The sizes of files are not issue here, because those files that I can't upload are smaller than that of mp4 file.
So I'm thinking something must be wrong with mime type that I used or video file itself, but I have no idea why it is happening.
Can anyone please help me out?