0
Hello, I am trying to upload an audio file in php, the problem is that the file should be moved to a name with accentuation, til, for example. Example: Save the file named Sebastião.mp3, but php at the time of moving the file upload moves with the name of Sebastiã£o.mp3
look at the upload.php file
$target_dir = "../../mp3/";
$nomeF="Sebastião"; <- aqui eu pego no banco de dados o nome...
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$target_file2=utf8_encode($target_dir).$nomeF.utf8_encode(".mp3"); <- tentei codificar o arquivo mas nao deu resultado
ou
$target_file2=$target_dir.$nomeF.".mp3";
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
if ($_FILES["fileToUpload"]["size"] > 59900000) {
$uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "mp3" ) {
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file2)) {
} else {
}
}
However, as I said, the file saved wrong. Someone knows what to do?
So, as I had need to solve the problem fast, I took a function that removes the accents, and saves the file without the accents, so don’t give me problems when saving or reading... Ai became easy, just use a function that does this both in php, which I use to save mp3, and the javascript that I use to read the file, as well as the python that I use to read the file in a script : )
– Moto Taxi Patense