Bonjour
J'ai un script qui permet d'update une image pour d'updater cette image (le nom) dans ma base de donnée pour l'attribuer a l'annonce
je fais appel a cette page a l'aide d'une url
www.monsite.com/uploadphoto.php?idannonce=
mais rien a faire la phote est bien envoyer sur le serveur mais pas update dan sma table je ne vois l'erreur
j'ai fais une echo $photo et c'est bien le nom de la photo
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 require_once('Connections/webcar.php'); mysql_select_db($database_webcar, $webcar); $rep_destination=$_SERVER['DOCUMENT_ROOT']."/Foto"; $extensions_ok = array('png', 'gif', 'jpg', 'jpeg'); $MAX_FILE_SIZE = 300000; if($_POST['ok']){ if (is_uploaded_file($_FILES["photo"]["tmp_name"])) $destination=$rep_destination."/".$_FILES["photo"]["name"]; move_uploaded_file($_FILES["photo"]["tmp_name"],$destination); $photo=$_FILES['photo']['name']; $sql="update annonce set photo='Foto/$photo', img='oui' where idannonce='$idannonce'"; $res=mysql_query($sql) or die (mysql_error()); header ("location: home.php"); }
Partager