Hello and thanks for reading my question.
I have an upload script and it uploads images/resizes and doesn't upload a php script with .php extention. However, if I rename my php script to .jpg and upload it the file is uploaded but thank goodness does not run when I view it in a browser.
My question is why does it even upload ?
I'm using strpos instead of strstr
Here is my call
$FileType = findFileType($_FILES["{$Input}"]['type'], $_FILES["{$Input}"]['name']);
Here is my check
FUNCTION findFileType( $type, $name )
{
GLOBAL $video_ext;
// strlen( strpos($mystring, $findme) ); #Alt use strstr( $type, "wav" ) but more memory
IF ( ( strlen( strpos( $type, "wav" ) ) ) ) {
RETURN "audio";
}
ELSEIF( strlen( strpos( $type, "jpeg" ) ) || strlen( strpos( $type, "jpg" ) ) || strlen( strpos( $type, "gif" ) ) || strlen( strpos( $type, "png" ) ) ){
RETURN "photo";
}
ELSEIF( strlen( strpos( $type, "video" ) ) && strlen( strpos( strtolower( $name ), $video_ext ) ) ){
RETURN "video";
}ELSE{
RETURN "unknown";
}
}
When I run this it returns as $FileType = photo with a php file that is modified to have a jpg extention.
I want to prevent scripts from being uploaded.