[SOLVED] File Upload Problem!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

File Upload Problem!

Post by Joe »

I have managed to make a file upload script which works great for uploading .zip files but the only problem is that I am wishing for Excel and .doc files to be uploaded also. My protection against other uploads gos like:

if ($_FILES['imagefile']['type'] != "application/x-zip-compressed")

I know that application/x-zip-compressed is for zipped files but what exactly would I use for excel and .doc files?


Regards


Joe 8)
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Upload the file and echo $_FILES['imagefile']['type']

Heres a list of popular mimi types:

'text/html',
'text/plain',
'text/css',
'image/gif',
'image/x-png',
'image/jpeg',
'image/tiff',
'image/x-ms-bmp',
'audio/x-wav',
'application/x-pn-realaudio',
'video/mpeg',
'video/quicktime',
'video/x-msvideo',
'application/postscript',
'application/rtf',
'application/pdf',
'application/x-pdf',
'application/x-gtar',
'application/x-tar',
'application/zip',
'application/x-zip-compressed',
'application/mac-binhex40',
'application/x-stuffit',
'application/octet-stream',
'text/javascript',
'application/x-javascript',
'application/x-sh',
'application/x-csh',
'application/x-perl',
'application/x-tcl',
'application/vnd.ms-powerpoint',
'application/ms-powerpoint',
'application/vnd.ms-excel',
'application/msword',
'video/avi',
'java/*',
'application/java',
'image/x-icon',
'image/bmp',
'image/pjpeg',
'application/x-bittorrent',
'audio/mpeg'
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Thanks alot kettle_drum. Much appreciated ;)
Post Reply