Hi all,
I'm fairly new to PHP so this is probably something quite simple. I'm using a Switch statement to trap the MIME Type of an uploaded file. The plan is then to the file to a folder, i.e. an image would go into the images folder for instance.
The problem I am having is no matter what I upload the code seems to identify the file as an Audio file.
Here is my code hope someone can help:
switch ($_FILES['uploaded_image']['type'])
{
default:
echo 'This file type is not supported <br/>';
break;
case 'audio/x-mpegurl' || 'audio/mp4a-latm' || 'audio/mp4a-latm' || 'audio/mp4a-latm' || 'audio/mpeg' || 'audio/mpeg' || 'audio/mpeg' || 'audio/x-wav':
echo 'File type: Audio <br/>';
move_uploaded_file($_FILES['uploaded_image']['tmp_name'], '/aciadb/files/audio/' . $_FILES['uploaded_image']['name']);
break;
case 'text/plain' || 'application/msword' || 'application/pdf' || 'text/rtf' || 'text/richtext' || 'text/plain' || 'application/vnd.ms-excel':
echo 'File type: Document <br/>';
move_uploaded_file($_FILES['uploaded_image']['tmp_name'], '/aciadb/files/docs/' . $_FILES['uploaded_image']['name']);
break;
case 'image/bmp' || 'image/gif' || 'image/jpeg' || 'image/jpeg' || 'image/jpeg' || 'image/png' || 'image/tiff' || 'image/tiff':
move_uploaded_file($_FILES['uploaded_image']['tmp_name'], '/aciadb/files/images/' . $_FILES['uploaded_image']['name']);
$image = new SimpleImage();
$image->load('/aciadb/files/images/' . $_FILES['uploaded_image']['name']);
$image->resizeToWidth(1024);
$image->save('/aciadb/files/images/' . $_FILES['uploaded_image']['name']);
echo 'File type: Image<br/>';
break;
case 'video/vnd.mpegurl' || 'video/x-m4v' || 'video/x-msvideo' || 'video/quicktime' || 'video/mp4' || 'video/mpeg' || 'video/mpeg' || 'video/mpeg':
echo 'File type: Video <br>/';
move_uploaded_file($_FILES['uploaded_image']['tmp_name'], '/aciadb/files/video/' . $_FILES['uploaded_image']['name']);
break;
}