Problemas com limitação de extensões
Pessoal, tenho o seguinte código:
<?php
set_time_limit(0);
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
// Uncomment the following line if you want to make the directory if it doesn't exist
// mkdir(str_replace('//','/',$targetPath), 0755, true);
$extensoes = array(".jpg", ".ai", ".pdf", ".cdr", ".psd",".zip",".rar",".indd",".ps",".gif",".tiff",".eps");
if (!in_array(strrchr($_FILES['Filedata']['name'], "."), $extensoes)) {
echo "";
}else{
move_uploaded_file($tempFile,$targetFile);
}
}
echo "1";
?>
Problema dele é que não está limitando as extensões como deveria. O que há de errado com ele?
Discussão (3)
Carregando comentários...