I'm using the following code:
$uploaddir = '../vagas/';
$uploadfile = $uploaddir . basename($_FILES['img']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "Arquivo válido e enviado com sucesso.\n";
} else {
echo "Possível ataque de upload de arquivo!\n";
}
echo 'Aqui está mais informações de debug:';
print_r($_FILES);
print "</pre>";
HTML is like this
<input type="file" name="img" id="img">
The error you display is Possible file upload attack! Here is more debug info: Array ( [img] = > Array ( [name] = > download.jpeg [type] = > image / jpeg [tmp_name] = > / Applications / XAMPP / xamppfiles / temp / phpOPe968 [error] = > 0 [size] = > 5555 )
)
But you are not uploading, I already gave chmos to the server folder but anyway ... How can I solve? And if possible how could I rename the file? Thanks