Bonjour,
Je me trouve face un problème et ce n'est pas faute d'avoir cherché sur le web.
Je m'explique, j'ai un formulaire :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
<form  name="accueil" method="post" action="modifier-index-envoi.php?id_langue=<?php echo $id_langue; ?>" enctype="multipart/form-data"  onSubmit="return verification();">
<fieldset>
		<?php 
		$res1=mysqli_query($bdd, "SELECT * FROM `accueilBDD` WHERE `id_langue`='$id_langue'");
		mysqli_query($bdd, "SET NAMES UTF8");
        while ($row1 = mysqli_fetch_array($res1))
            {
				$title_ref=stripslashes($row1['title_ref']);
				$descript=stripslashes($row1['descript']);
				$kyword=stripslashes($row1['kyword']);
				$alternativ_logo=stripslashes($row1['alternativ_logo']);
				$title_logo=stripslashes($row1['title_logo']);
				$titre_societe=stripslashes($row1['titre_societe']);
				$texte_societe=stripslashes($row1['texte_societe']);
				$image_societe_1=$row1['image_societe_1'];
				$th_image_societe_1=$row1['th_image_societe_1'];
				$alt_image_1=stripslashes($row1['alt_image_1']);
				$title_image_1=stripslashes($row1['title_image_1']);
				$image_societe_2=$row1['image_societe_2'];
				$th_image_societe_2=$row1['th_image_societe_2'];
				$alt_image_2=stripslashes($row1['alt_image_2']);
				$title_image_2=stripslashes($row1['title_image_2']);
				$lien_mentions=stripslashes($row1['lien_mentions']);
				$mentions=stripslashes($row1['mentions']);
				$lien_plan=stripslashes($row1['lien_plan']);
				$plan=stripslashes($row1['plan']);
				$lien_contact=stripslashes($row1['lien_contact']);
				$contact=stripslashes($row1['contact']);
			}?>
      <h3>Référencement de la page : </h3>
      <label>Titre : <input name="title_ref" type="text" value="<?php echo $title_ref; ?>"></label>
      <label>Description : <input name="descript" type="text" value="<?php echo $descript; ?>"></label>
      Mots clés :
      <textarea name="kyword" cols="62" rows="4" ><?php echo $kyword; ?></textarea>
      <label>Alt Logo : <input name="alternativ_logo" type="text" value="<?php echo $alternativ_logo; ?>"></label>
      <label>titre logo : <input name="title_logo" type="text" value="<?php echo $title_logo; ?>"></label>
      <h3>La Société</h3>
      <label>Titre société : <input name="titre_societe" type="text" value="<?php echo $titre_societe; ?>"></label>
      Texte société : <br />
      <textarea name="texte_societe" rows="20" style="width:790px" ><?php echo $texte_societe; ?></textarea>
      <label>Image 1 : <input name="upload[]" type="file" src="../jpg/<?php echo $image_societe_1; ?>"  multiple="multiple" ></label>
      <label>Alt1 : <input name="alt_image_1" type="text" value="<?php echo $alt_image_1; ?>"></label>
      <label>Titre1 : <input name="title_image_1" type="text" value="<?php echo $title_image_1; ?>"></label>
      <label>Image 2 : <input name="upload[]" type="file" src="../jpg/<?php echo $image_societe_2; ?>"  multiple="multiple" ></label>
      <label>Alt2 : <input name="alt_image_2" type="text" value="<?php echo $alt_image_2; ?>"></label>
      <label>Titre2 : <input name="title_image_2" type="text" value="<?php echo $title_image_2; ?>"></label>
      <h3>Footer</h3> 
      <label>Mentions : <input name="mentions" type="text" value="<?php echo $mentions; ?>"></label>
      <label>Lien Mentions : <input name="lien_mentions" type="text" value="<?php echo $lien_mentions; ?>"></label>
      <label>plan : <input name="plan" type="text" value="<?php echo $plan; ?>"></label>
      <label>Lien plan : <input name="lien_plan" type="text" value="<?php echo $lien_plan; ?>"></label>
      <label>contact : <input name="contact" type="text" value="<?php echo $contact; ?>"></label>
      <label>Lien contact : <input name="lien_contact" type="text" value="<?php echo $lien_contact; ?>"></label>
<input type="submit" name="Submit" value="Enregistrer" class="btn-default">
<a class="btn-default" href="index.php" style="float:right">Annuler</a>	
</fieldset>
</form>
et une page qui est censé enregistrer dans la base de données :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?php 
include ('../inc/connexion.php');
$id_langue = $_REQUEST['id_langue'];
$title_ref = $_REQUEST['title_ref'];
$descript = $_REQUEST['descript'];
$kyword = $_REQUEST['kyword'];
$alternativ_logo = $_REQUEST['alternativ_logo'];
$title_logo = $_REQUEST['title_logo'];
$titre_societe = $_REQUEST['titre_societe'];
$texte_societe = $_REQUEST['texte_societe'];
$alt_image_1 = $_REQUEST['alt_image_1'];
$title_image_1 = $_REQUEST['title_image_1'];
$alt_image_2 = $_REQUEST['alt_image_2'];
$title_image_2 = $_REQUEST['title_image_2'];
$lien_mentions = $_REQUEST['lien_mentions'];
$mentions = $_REQUEST['mentions'];
$lien_plan = $_REQUEST['lien_plan'];
$plan = $_REQUEST['plan'];
$lien_contact = $_REQUEST['lien_contact'];
$contact = $_REQUEST['contact'];
 
foreach($_REQUEST['upload'] as $term){ 
 
function redimenssioner_image($file, $w, $h){
	list($width,$height) = getimagesize($file);
	// si plus grand le paramètre ?
	if($width >= $w || $height >= $h){
		// si paysage
		if($width >= $height){
			$dst_w = $w;
			$dst_h = ($w * $height)/$width;
			// si après calcul height2 dépasse $h
			if($dst_h >= $h){
				$dst_w = ($width * $h)/$height;
				$dst_h = $h;
			}
		}
		// si portrait
		else{
			$dst_w = ($width * $h)/$height;
			$dst_h = $h;
		}
	}
	// sinon remet pareil
	else{
		$dst_w = $width;
		$dst_h = $height;
	}
 
	// récupération de la taille
	$size = @GetImageSize($file);
	$src_w = $size[0];
	$src_h = $size[1];
	// redimensionnement de l'image (garde le ratio)
	if($src_w < $dst_w && $src_h < $dst_h){
		$dst_w = $src_w;
		$dst_h = $src_h;
	}
	else @$dst_h = round(($dst_w / $src_w) * $src_h);
 
	$dst_img = ImageCreateTrueColor($dst_w, $dst_h);	
	$src_img = ImageCreateFromJpeg($file);
	// crée la copie redimensionnée
	@ImageCopyResampled($dst_img, $src_img, 0, 0, 0, 0, $dst_w, $dst_h, $src_w, $src_h);
	// --> jpg
	@ImageJpeg($dst_img, $file,70);
	// destruction des images temporaires
	@ImageDestroy($dst_img);
	@ImageDestroy($src_img);
}
 
function redim_coupe_image($img_src, $img_dest, $dst_w, $dst_h){
	$size = GetImageSize($img_src);  
	$src_w = $size[0]; 
	$src_h = $size[1];
	$qualite = 90;
 
	copy($img_src, $img_dest);
 
	// si carré
	if($src_w == $src_h){
		$test_h = round(($dst_w / $src_w) * $src_h);
		$test_w = round(($dst_h / $src_h) * $src_w);
		// Si Height final non precise (0)
		if(!$dst_h)$dst_h = $test_h;
		// Sinon si Width final non precise (0)
		elseif(!$dst_w)$dst_w = $test_w;
		// Sinon teste quel redimensionnement tient dans la zone
		elseif($test_h>$dst_h)$dst_w = $test_w;
		else $dst_h = $test_h;
 
		$dst_img = ImageCreateTrueColor($dst_w, $dst_h);
		$src_img = ImageCreateFromJpeg($img_dest);
		// crée la copie redimensionnée
		@ImageCopyResampled($dst_img, $src_img, 0, 0, 0, 0, $dst_w, $dst_h, $src_w, $src_h);
		@ImageJpeg($dst_img, $img_dest,$qualite);
		@ImageDestroy($dst_img);
		@ImageDestroy($src_img);
	}
	else{
		// paysage
		if($src_w > $src_h){
			$dst_w_temp = round(($src_w * $dst_h) / $src_h);
			$dst_h_temp = $dst_h;
 
			// si après calcul, c'est pas assez, on refait...
			if($dst_w_temp < $dst_w){
				$dst_w_temp = $dst_w;
				$dst_h_temp = floor(($dst_w * $src_h) / $src_w);
			}
		}
		else{
			// si portrait
			$dst_w_temp = $dst_w;
			$dst_h_temp = floor(($dst_w * $src_h) / $src_w);
 
			// si après calcul, c'est pas assez, on refait...
			if($dst_h_temp < $dst_h){
				$dst_w_temp = round(($src_w * $dst_h) / $src_h);
				$dst_h_temp = $dst_h;
			}
		}
		$dst_img = ImageCreateTrueColor($dst_w_temp, $dst_h_temp);
		$src_img = ImageCreateFromJpeg($img_dest);
 
		@ImageCopyResampled($dst_img, $src_img, 0, 0, 0, 0, $dst_w_temp, $dst_h_temp, $src_w, $src_h);
 
		@ImageJpeg($dst_img, $img_dest);
		@ImageDestroy($dst_img);
		@ImageDestroy($src_img);
 
		// Lit les dimensions de l'image deja redim
		$size = GetImageSize($img_dest);  
		$src_w = $size[0]; 
		$src_h = $size[1];
		$source = imagecreatefromjpeg($img_dest); // celle qui sera copiée
 
		unlink($img_dest); //on detruit l'image temp
 
		$dest_x = 0; // On colle l'image sur l'autre a 0 en abscisse
		$dest_y = 0; // On colle l'image sur l'autre a 0 en ordonnee
		$src_departx = ($src_w - $dst_w)/2; // on part de (largeur d'origine - largeur desire)/2 => Permet de centrer 
		$src_departy = ($src_h - $dst_h)/2; // on part de (hauteur d'origine - hauteur desire)/2 => Permet de centrer
 
		$destination = imagecreatetruecolor($dst_w,$dst_h);// on creer une image de la taille du cadre à copier
 
		//$src_departx = 0;
 
		imagecopy($destination, $source, $dest_x, $dest_y, $src_departx, $src_departy, $dst_w, $dst_h);
		imagejpeg($destination, $img_dest,$qualite);
	}
}
 
$dossier_img = 'jpg/';
$resize_w = 450;
$resize_h = 180;
$resizeth_w = 40;
$resizeth_h = 40;
 
 
for($i=0; $i<count($_FILES['upload']['name']); $i++) {
  //Get the temp file path
  $tmpFilePath = $_FILES['upload']['tmp_name'][$i];
 
  //Make sure we have a filepath
  if ($tmpFilePath != ""){
    //Setup our new file path
    $newFilePath = "./jpg/" . $_FILES['upload']['name'][$i];
 
	$ex=explode (".",$_FILES['upload']['name']);
    $c=count ($ex);
    $exten=$ex[$c-1];
 
	$image = substr($_FILES['upload']['name'],0,-4);
	$image = nettoie_nom_fichier($image);
 
	$image .= '.jpg';
 
	$file = $dossier_img.$image;
	echo $file;
 
	move_uploaded_file($_FILES['upload']['tmp_name'],$file);
	redimenssioner_image($file,$resize_w,$resize_h);
 
	$file_th = $dossier_img.'th-'.$image;
	redim_coupe_image($file,$file_th,$resizeth_w,$resizeth_h);
 
}  
  }
}
$requete='UPDATE accueilBDD SET title_ref = "'.$title_ref.'", descript = "'.$descript.'", kyword = "'.$kyword.'", alternativ_logo = "'.$alternativ_logo.'", title_logo = "'.$title_logo.'", titre_societe = "'.$titre_societe.'", texte_societe = "'.$texte_societe.'", alt_image_1 = "'.$alt_image_1.'", title_image_1 = "'.$title_image_1.'", alt_image_2 = "'.$alt_image_2.'", title_image_2 = "'.$title_image_2.'", lien_mentions = "'.$lien_mentions.'", mentions = "'.$mentions.'", lien_plan = "'.$lien_plan.'", plan = "'.$plan.'", lien_contact = "'.$lien_contact.'", contact = "'.$contact.'" WHERE id='.$id_langue;
mysqli_query($bdd, "SET NAMES UTF8");
$resultatsqli=mysqli_query($bdd, $requete)  or die ('Erreur lors de la mise à jour: '.var_export($requete, true).' <br />'.mysqli_error($bdd));
 
?>
Je ne sais pas du tout comment écrire l'enregistrement des photos dans ma base de données.
Si vous aviez une idée pour m'aider. je prends.
Merci pour votre aide.

Audrey