Created
April 14, 2022 15:11
-
-
Save othonet/5f3cb3b2346c6b6876667efe085fdc09 to your computer and use it in GitHub Desktop.
PHP - Validate Extension Archive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$extensoes_aceitas = array('bmp' ,'png', 'svg', 'jpeg', 'jpg'); | |
$array_extensoes = explode('.', $_FILES['foto']['name']); | |
$extensao = strtolower(end($array_extensoes)); | |
if (array_search($extensao, $extensoes_aceitas) === false): | |
echo 'Extensão válida'; | |
else: | |
echo 'Extensão inválida'; | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment