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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
| <?php
$id = $_GET['id'];
//------------------------------------
// les images
//------------------------------------Program Files\\EasyPHP1-7\\www\\transport\\fred2\\module\\
$patc="C:\\big\\";
print '<input type="file" accept="111" size="20" name="fichier3" value="C:\big\650_riad_2.jpg">';
//-----------------------------------------------------------
//$_FILES['fichier1']['name']="http://127.0.0.1/transport/fred2/module/big/".;//img1*/
//The first parameter is the form's input name and the second index can be either "name", "type", "size", "tmp_name" or "error". Like this:
$_FILES['fichier1']($id.'_riad_1','.jpg',$patc,'');
/*$_FILES['fichier1']['name']=;
$_FILES['fichier1']['size']="12121";
$_FILES['fichier1' ]['tmp_name']=$patc;*/
print $_FILES['fichier1']['name']."***|".$taille = $_FILES['fichier1']['size']."***|".$_FILES['fichier1' ]['tmp_name'];
$_FILES['fichier2']=$patc.$id."_riad_2.jpg";//img2
$_FILES['fichier4']=$patc.$id."_fez_house_1.jpg";//img1
$_FILES['fichier5']=$patc.$id."_fez_house_2.jpg";//img2
$_FILES['fichier6']=$patc.$id."_fez_house_3.jpg";//img3
//-----------------------------------------------------------
$_FILES['fichier']= "smal/".$id."_riad_ac";//accueil
//--------------------------------------
// DEFINITION DES VARIABLES
//--------------------------------------
$extension = ".jpg";// Extension du fichier
$max_size = 100000000000000000;// Taille max en octets du fichier
$width_max = 100000000000000000;// Largeur max de l'image en pixels
$height_max = 100000000000000000000;// Hauteur max de l'image en pixels
//------------------------------------------------------------
// DEFINITION DES VARIABLES LIEES AU FICHIER
//------------------------------------------------------------
for ($i = 1; $i <= 6; $i++)
{
if ($i<=3){
$target = "big/";// Repertoire cible
}else{$target = "smal/";}// Repertoire cible
$nom_file = $_FILES['fichier' . $i]['name'];
$taille = $_FILES['fichier' . $i]['size'];
$tmp = $_FILES['fichier' . $i]['tmp_name'];
$chemin = $target . $id . '_rednourfesweb_' . $i . strtolower(substr(strrchr($nom_file,"."), 0));
print $_FILES['fichier'.$i]['tmp_name'];
//['name'];
@move_uploaded_file($tmp, $chemin);
// Si upload OK alors on affiche le message de réussite
echo '<p align="center">';
echo '<font face="Verdana" size="2" color="#FF0000">';
echo '<b>Image uploadée avec succès !</b>';
echo '</font>';
echo '<hr>';
echo '<b>Fichier :</b>' . $_FILES['fichier' . $i]['name'] . '</br>';
echo '<b>Taille :</b>' . $_FILES['fichier' . $i]['size'] . ' Octets</br>';
echo '<b>Largeur :</b> ' . $infos_img[0] . ' px</br>';
echo '<b>Hauteur :</b> ' . $infos_img[1] . ' px</br>';
echo '<hr>';
echo '<br><br>';
//---------------------------
// SCRIPT D'UPLOAD
//---------------------------
// On vérifie si le champ est rempli
if (isset($_FILES['fichier' . $i]['name']))
{
// On vérifie les dimensions et taille de l'image
if (($infos_img[0] <= $width_max) && ($infos_img[1] <= $height_max) && ($taille <=
$max_size))
{
// Si c'est OK, on teste l'upload
if (@move_uploaded_file($tmp, $chemin))
{
// Si upload OK alors on affiche le message de réussite
echo '<p align="center">';
echo '<font face="Verdana" size="2" color="#FF0000">';
echo '<b>Image uploadée avec succès !</b>';
echo '</font>';
echo '<hr>';
echo '<b>Fichier :</b>' . $_FILES['fichier' . $i]['name'] . '</br>';
echo '<b>Taille :</b>' . $_FILES['fichier' . $i]['size'] . ' Octets</br>';
echo '<b>Largeur :</b> ' . $infos_img[0] . ' px</br>';
echo '<b>Hauteur :</b> ' . $infos_img[1] . ' px</br>';
echo '<hr>';
echo '<br><br>';
}
else
{
// Sinon on affiche une erreur système
echo '<p align="center">';
echo '<font face="Verdana" size="2" color="#FF0000">';
echo '<b>Problème lors de l\'upload !</b>';
echo '</font><br><br>';
}
}
else
{
// Sinon erreur sur les dimensions et taille de l'image
echo '<p align="center">';
echo '<font face="Verdana" size="2" color="#FF0000">';
echo '<b>Erreur dans les dimensions ou taille de l\'image !</b>';
echo '</font><br><br>';
}
}
}
?> |
Partager