Hi all,
I am struggling to see the problem with my Switch statement below. I am trying to catch the MIME File Type of an uploaded document so I can move the temporary uploaded file to the relevant folder on my website.
Here is the code:
[code=php]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;
}[/code]
The file is uploading, but always into the Audio directory. Any help would be gratefully appreciated as I'm running out of hair to pull out!
Many thanks,