Heya all, as the title says, i meet some issues when uploading files to my server, here is the code;
$anime = $_POST['anime'];
$anime = $file = str_replace(' ', '\ ', $anime);
$anime = "Sous-titres/".$anime."/";
$target_dir = $anime;
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
if(isset($_POST["submit"])) {
// Check if file already exists
if (file_exists($target_file)) {
echo "Sorry, file already exists.";
$uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 50000000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
echo "The file " . basename($_FILES["fileToUpload"]["name"]) . " has been uploaded.";
} else {
var_dump ($target_dir);
echo "Sorry, there was an error uploading your file.";
}
}
}
So, i'm attempting to acces to a directory taking the name of the anime that the admin put in the input type="text", for upload the file selected in.
Error with the var_dump: string(28) "Sous-titres/Akame\ ga\ kill/" Sorry, there was an error uploading your file.
Hope you can help me !