Skip to content

Instantly share code, notes, and snippets.

@ayhanbaris
Created September 9, 2022 16:47
Show Gist options
  • Save ayhanbaris/5850e49a82c3b0f29161b5ec75f0206c to your computer and use it in GitHub Desktop.
Save ayhanbaris/5850e49a82c3b0f29161b5ec75f0206c to your computer and use it in GitHub Desktop.
isUploadable() detect if file is uploadable
public static function isUploadable($fileName)
{
$uploadable = true;
if( strpos($fileName, '.php') !== false ) {
$uploadable = false;
}
if( strpos($fileName, '.js') !== false ) {
$uploadable = false;
}
if( strpos($fileName, '.sql') !== false ) {
$uploadable = false;
}
if( strpos($fileName, '.py') !== false ) {
$uploadable = false;
}
if( strpos($fileName, '.exe') !== false ) {
$uploadable = false;
}
if( strpos($fileName, '.html') !== false ) {
$uploadable = false;
}
if( strpos($fileName, '.svg') !== false ) {
$uploadable = false;
}
if( strpos($fileName, '.phtml') !== false ) {
$uploadable = false;
}
if( strpos($fileName, '.sh') !== false ) {
$uploadable = false;
}
return $uploadable;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment