1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| <fieldset><legend>Formulaire d'envoi</legend>
<form action="<?php $_SERVER["PHP_SELF"] ?>" enctype="multipart/form-data" method="post"name="fichier">
<label>Fichier :</label> <input type="file" name="mon_fichier" /><br />
<button type="submit">Envoi</button>
</form></fieldset>
<?php
if (!empty($_FILES))
{
$type_fichier = move_uploaded_file($_FILES["mon_fichier"]["type"], "");
if($type_fichier == "image/pjpeg")
{
$resultat = move_uploaded_file($_FILES["mon_fichier"]["tmp_name"], "../photographies/myname.jpg");
if ($resultat == true)
{
print("Fichier bien transféré !");
}
else
{
print("Fichier non transféré !");
print($_FILES["mon_fichier"]["error"]);
}
}
}
?> |
Partager