1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
namespace UploadCtl;
class UploadCtl{
// .............................................. Constants ...................................
// Types beginning with "x-" are not standard and does not appear in list below
const ALLOWED_TYPES = [
// format: extension=>typeMIME
//'*'=>'application/octet-stream',
'zip'=>'application/zip',
'rar'=>'application/x-rar',
'7z'=>'application/x-7z-compressed',
'tar'=>'application/x-tar',
'pdf'=>'application/pdf',
'gif'=>'image/gif',
'jpeg'=>'image/jpeg',
'jpg'=>'image/jpeg',
'png'=>'image/png',
'tiff'=>'image/tiff',
'tif'=>'image/tiff',
'mpeg'=>'audio/mpeg',
'mp3'=>'audio/mpeg',
'mp4'=>'video/mp4',
//'wav'=>'audio/x-wav',
'txt'=>'text/plain',
//'csv'=>'text/csv', must be always checked
'csv'=>'text/plain',
'sql'=>'text/plain',
//'css'=>'text/css',
'css'=>'text/plain',
'html'=>'text/html',
'htm'=>'text/html',
'rtf'=>'application/rtf',
'doc'=>'application/msword'
];
const IMAGE_TYPES = [
'gif'=>'image/gif',
'jpeg'=>'image/jpeg',
'jpg'=>'image/jpeg',
'png'=>'image/png',
'tiff'=>'image/tiff',
'tif'=>'image/tiff',
];
//define('ALLOWED_TYPES_KEYS', array_keys(self::ALLOWED_TYPES));
//const ALLOWED_TYPES_KEYS = array_keys(self::ALLOWED_TYPES);
//const IMAGE_TYPES_KEYS = array_keys(self::IMAGE_TYPES);
//private $keys = array_keys(self::ALLOWED_TYPES); |
Partager