This is what I use for uploading images on my website and it seems to work just fine..
PHP Code:
// include all allowed mime types here
$allowed = array(
'image/pjpeg' => 'jpg',
'image/jpeg' => 'jpg',
'image/gif' => 'gif',
'image/bmp' => 'bmp',
'image/x-png' => 'png'
);
// check that uploaded type is allowed.
if( !array_key_exists( $_FILES['filename']['type'], $allowed ) ) {
echo "ERROR....FILE NOT ALLOWED" ;
} else {
echo "File type is allowed";
}
I also check that the file size is not zero (or below zero for that matter ) or higher than a given size.
Further, I use
chmod , to control the file properties once it has been uploaded to the server. Personally, I make it only readable, not executable and not writeable.
As for Apache reporting errors...I have not encountered any and I don't think it is Apache that would be throwing any errors...since PHP is the process that handles file uploads in this case. However, I encourage you to check on this.
Cheers,
Ess