if ('$imagetype' != '.jpg' || '.gif' || '.png')
Heh... where to begin.
Well, first up, quotes aren't needed around $imagetype. But if you had used double quotes that part at least would be valid. When you use single quotes the string is not parsed for variable replacement by php. So it takes '$imagetype' as literally that text.
Also conditionals don't work the way you are trying to use them. You are trying to test for $imagetype not being jpg, gif, or png. What you're actually doing in this if statement is checking whether $imagetype is not equal to jpg, or if the text ".gif" is true, or if the text ".png" is true. When you test a non-boolean value for true/false it is converted to a boolean, and a non-empty string will be considered true.
You could do this with an if statement like this
if ($imagetype != '.gif' && $imagetype != '.jpg' ...)
Or you could use a switch statement
switch ($imagetype) {
case '.gif':
case '.jpg':
break;
default:
...
}