I have this code copied from http://php.net/manual/es/features.file-upload.post-method.php and I tried it today, but I can't upload files.
Notice: Undefined index: file in C:\xampp\htdocs\kappa.php on line 13
Notice: Undefined index: file in C:\xampp\htdocs\kappa.php on line 16
¡Posible ataque de subida de ficheros!
Code:
<?php
if (isset($_POST['btn'])){
$dir_subida = '';
$fichero_subido = $dir_subida . basename($_FILES['fichero_usuario']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['file']['tmp_name'], $fichero_subido)) {
echo "El fichero es válido y se subió con éxito.\n";
} else {
echo "¡Posible ataque de subida de ficheros!\n";
}
}
?>
<html>
<head>
</head>
<body>
<form action="" method="post">
<input type="file" name="file">
<input type="submit" name="btn">
</form>
</body>
</html>
I tried to use diferent scripts, but it keeps throwing the same error.
I always have access to the path and all that stuff.