Buongiorno non riesco a capire il perchè non stampa a video: il file è stato caricato con successo nella cartella nomecartella
Codice:
<?php
// Check if the form was submitted
if($_SERVER["REQUEST_METHOD"] == "POST"){
// Check if file was uploaded without errors
if(isset($_FILES["file"]) && $_FILES["file"]["error"] == 0){
// Get the subdirectory from the select element
$subdir = $_POST["subdir"];
// Set the destination path and filename
$target_dir = "../documenti/" . $subdir . "/";
echo "<br></br>",
$target_file = $target_dir . basename($_FILES["file"]["name"]);
// Move the uploaded file to the destination
if(move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)){
non funzionaa---->echo "<b><br>Il file ". basename( $_FILES["file"]["name"]). " caricato con successo nella cartella di " . $subdir . ".";
header('Location: http://localhost/sito/admin/gestione.php');
} else{
echo "Sorry, there was an error uploading your file.";
}
} else{
echo "Error: " . $_FILES["file"]["error"];
}
}
?>
</div>
<?php
$foldername = glob("../documenti/*");
?>
<form action="gestione.php" method="post" enctype="multipart/form-data">
<td><label for="select-cartella">Scegli la cartella di destinazione</label>
</div>
<select name="subdir" id="subdir">
<?php foreach($foldername as $foldername): ?>
<option value="<?= htmlspecialchars(basename($foldername)) ?>"><?= htmlspecialchars(basename($foldername)) ?></option>
<?php endforeach ?>
</select>
<input type="file" name="file" id="file">
<input type="submit" value="Invia" name="submit">
</form></div>