here is code that I am working on.
What it is supposed to do is upload a media file (image, audio, video) and then tell me what type of media it is.
$media_type='image';
$filename=$_FILES["file"]["name"];
$extension = explode(".", $filename);
$extension = end($extension);
//echo $extension;
if (($_FILES["file"]["size"] < 50000)
&& (!$_FILES["file"]["error"] > 0) )
{
$allowedPicExt = array("jpg", "jpeg", "gif", "png");
if (in_array($extension, $allowedPicExt))
{
$media_type='image';
}
$allowedAudioExt = array('mp3', "wav");
if (in_array($extension, $allowedAudioExt))
{
$media_type='audio';
}
$allowVideoExt=array("mp4","ogg");
if (in_array($extension, $allowVideoExt))
{
$media_type='video';
}
}
echo "--".$extension."--".$media_type;
Tested it with a png and it gives me back --png--image
Tried it with a mp3 and then only gives me back --mp3--
I have looked at every angle on this one but not seeing what I am doing wrong. The part that saves the file is not shown, but it does work and saves the file as it is supposed to...
Any advice??