Be notified of new comments on this post with the RSS feed for this post.
You can use a restricted version of markdown formatting here. You can use the toolbar above the text field to make this more painless. For more information about markdown please refer to the markdown cheatsheet.
Your solution wouldn't work due to the undefined
getext()function. Aside from checking the suffix, you could just check that a valid image type was supplied.<?php // i assume here that the form field name value is "imagefile" $imagename = basename($_FILES['imagefile']['name']); $ext = substr($imagename, strrpos($imagename, '.') + 1); // i hate suppression but you don't seem to mind it if(@exif_imagetype($_FILES['imagefile']['tmp_name']) !== false) { // process it here, its a valid image type, also do other checks } else { @unlink($_FILES['imagefile']['tmp_name']); // its bad, get rid } ?>