I have a problem with the way to save the upload file. I have a php file that does the update that is in the folder it processes, and an upload folder to save the files that have been saved.
$id = $_POST['id'];
$titulo = $_POST['titulo'];
$descricao = $_POST['descricao'];
$postador = $_POST['postador'];
$arquivo = $_FILES['arquivo']['name'];
//Substituindo os caracteres especiais
$original =
'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜüÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿRr"!@#$%&*
()_-+={[}]/?;:,\\'<>°ºª';
$substituir =
'aaaaaaaceeeeiiiidnoooooouuuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr
';
$arquivo = strtr(utf8_decode($arquivo), utf8_decode($original),
$substituir);
//Substitui os espaços em branco
$arquivo = str_replace(' ', '-', $arquivo);
//Substitui os Maiúsculos por Minúsculos
$arquivo = strtolower($arquivo);
$caminhofinal = "upload".'/'.$arquivo;
move_uploaded_file($_FILES['arquivo']['tmp_name'],$caminhofinal);
$sql_query = "UPDATE posts SET titulo = '$titulo', arquivo =
'$caminhofinal', descricao = '$descricao', data = NOW(), hora = NOW(),
postador = '$postador' WHERE id = '$id'";
$resultado = mysqli_query($mysqli, $sql_query);
if($resultado === TRUE){
$_SESSION['msg'] = "<div class='alert alert-success alert-dismissable'>
<a href='#' class='close' data-dismiss='alert' aria-
label='close'>×</a>
ID: $id Editado com Sucesso!</div>";
header("Location: ../professor/lista_conteudo.php");
} else {
$_SESSION['msg'] = "<div class='alert alert-danger'>
<a href='#' class='close' data-dismiss='alert' aria-
label='close'>×</a>
Erro ao Editar ID: $id</div>";
header("Location: ../professor/editar_conteudo.php");
}
The issue is that you are saving the url in the bank but not the file in the folder. already tried to put in the variable $ finalpath="../upload".'/'.$film; but it did not work. Can someone help me? Thanks!