First of all, look at your code: see all the red? The red is a string.
If you're going to use single quotes inside of strings denotd by single quotes (i.e. echo 'there's a ...';), then you MUST ESCAPE THE QUOTES inside the string with a backslash, i.e. echo 'there\'s a ...';.
That error occurs a few times in your script; fix that and get back to us.
Also, do you need to do MIME-type checking? Why not just compare file extensions? Especially since MIME-types are browser-dependent; what happens when you get a stupid browser that sends incorrect/no MIME types?