1
I would like to change this code that is working with mysql_*
for PDO
:
<?php
if ( isset($_POST['enviar']) ) {
$arquivo = $_FILES['arquivo']['name'];
$update = mysql_query("UPDATE cabecalho SET logo = '$logo");
if ($update == '') {
echo "<script language='javascript'>window.alert('Erro ao atualizar imagem!!!');</script>";
} else {
echo "<script language='javascript'>window.alert('Imagem cadastrada com sucesso!!!');</script>";
//referenciar a classe upload
include("../Upload.class.php");
$imagem = "";
if( isset($_FILES["arquivo"]) ){
$dir_dest = "../upload";
//linha que faz o upload
$upload = new Upload($_FILES['arquivo'], $dir_dest);
// verifica se foi realizado corretamente o upload
if ($upload->processed) {
$imagem=$upload->file_dst_name;
}
}
echo "<img src='../upload/$imagem'/><br /><br />";
echo "<img src='../upload/mini/$imagem'/>";
}
}
?>
<form action="" method="post" enctype="multipart/form-data" name="cadastro">
Imagem do Logo
<br /><br />
Logo : <input type="file" name="logo" />
<br /><br />
<input type="submit" value="Cadastrar" name="enviar">
</form>
I hug you all, and you get the attention.
very good your question, do the following place how far you have come and what test you have done so I can help you
– Otto
I answered your question, but your logic is wrong. You did not pass the database structure, you also did not pass the contents of the Upload.class.php file. I will improve the answer if you give me this information.
– Hiago Souza