Upload Image

cs_piep14 Messages postés 345 Date d'inscription lundi 15 mars 2004 Statut Membre Dernière intervention 13 mai 2011 - 28 mars 2005 à 14:49
ei_loubna2 Messages postés 20 Date d'inscription dimanche 23 octobre 2005 Statut Membre Dernière intervention 31 mai 2007 - 23 oct. 2005 à 16:24
Bonjour, je dois faire un upload d'une photo. J'ai donc fait ceci :

<?
$date = date('Y/m/d H:i:S');
$file = $_FILES['userfile'];
$stock = 'photos/';
$fichier = $date.'.jpg';

if(($file['type']=="image/jpg") || ($file['type']=="image/pjpeg") || ($file['type']=="image/jpeg"))
{
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $stock.$fichier))
{
mysql_query("UPDATE `advert` SET `photo`='$fichier' WHERE `advert_id`='6'");
echo "BIEN";
}
}


else
{
?>
<tr><td>

Vous devez choisir une photo d'extension .JPG</td></tr>

<?
}
?>

Mais cela ne marche pas car ca arrive directement Vous devez choisir une photo d'extension .JPG alors que j'ai bien qui une image jpg

2 réponses

stepibou Messages postés 112 Date d'inscription jeudi 11 mars 2004 Statut Membre Dernière intervention 11 octobre 2006
28 mars 2005 à 16:01
i understand the meaning of this shit.
enfin en francais , je crois comprendre :

dans ton non de fichier tu as les / de tes dates qui sont interprétés.
donc ca marche pas.
je te conseille de conserver le nom de ton temp file, car
la date et l'heure, tu l'as dans les proprietés de ton fichier.

voir
http://www.phpcs.com/code.aspx?id=30365
stepiboum
0
ei_loubna2 Messages postés 20 Date d'inscription dimanche 23 octobre 2005 Statut Membre Dernière intervention 31 mai 2007
23 oct. 2005 à 16:24
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
0
Rejoignez-nous