Bonjour,

Je suis nouveau sur le forum, je ne connais pas grand-chose en php et là je me retrouve avec un énorme problème ..

Après avoir passé plusieurs heures à lire ici et ailleurs pour trouver une solution je n'en ai point trouvé donc je me tourne vers vous afin je l'espère trouver de l'aide et qui sait une solution ..

Voilà mon problème .. en fait mon script d'upload d'images fonctionnent très bien en local .. mais dès que je l'up sur le serveur, la par contre il ne fonctionne pas du tout .. Alors que sur une autre partie du site il fonctionne parfaitement

Je vous colle ci-dessous le code ainsi que le long message d'erreur.. comme je vous l'ai dit je suis débutant, svp soyez indulgent avec moi.

le code de la page

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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<?php require_once('../Connections/chezyaya.php'); ?>
<?php require_once('../Connections/chezyaya.php'); 
 mysql_query ("SET NAMES UTF8");
 if($_GET['image'] != '')
								{
								$image = $_GET['image'];
								if(file_exists($image))
								{
								unlink($image);
								}
								}?>
<?php require_once('../Connections/chezyaya.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
 
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ajout")) {
  $insertSQL = sprintf("INSERT INTO articles (famille, id_categorie, prix, statut_promo, px_promo, nouveau, `desc`) VALUES (%s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['famille'], "text"),
                       GetSQLValueString($_POST['id_categorie'], "int"),
                       GetSQLValueString($_POST['prix'], "text"),
                       GetSQLValueString($_POST['statut_promo'], "text"),
                       GetSQLValueString($_POST['px_promo'], "text"),
                       GetSQLValueString($_POST['nouveau'], "text"),
                       GetSQLValueString($_POST['desc'], "text"));
 
  mysql_select_db($database_chezyaya, $chezyaya);
  $Result1 = mysql_query($insertSQL, $chezyaya) or die(mysql_error());
 
  $insertGoTo = "catalogue.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
 
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
mysql_select_db($database_chezyaya, $chezyaya);
$query_categorie_chaussure = "SELECT * FROM categories WHERE famille = 'chaussures-dame' ORDER BY categorie ASC";
$categorie_chaussure = mysql_query($query_categorie_chaussure, $chezyaya) or die(mysql_error());
$row_categorie_chaussure = mysql_fetch_assoc($categorie_chaussure);
$totalRows_categorie_chaussure = mysql_num_rows($categorie_chaussure);
 
mysql_select_db($database_chezyaya, $chezyaya);
$query_categories = "SELECT * FROM categories";
$categories = mysql_query($query_categories, $chezyaya) or die(mysql_error());
$row_categories = mysql_fetch_assoc($categories);
$totalRows_categories = mysql_num_rows($categories);
?>
 
<?  
$last_id = mysql_insert_id();	
switch($_FILES['fichier']['type'])
{
	case "image/jpg" OR "image/pjpeg":
	$ext=".jpg";
	break;
	case "image/gif" :
	$ext="gif";
	break;
	case "image/png":
	$ext=".png";
	break;
	case "application/pdf":
	$ext=".pdf";
	break;
 
}
if($_FILES['fichier']['error'] == 0)
{
	if($_FILES['fichier']['type'] =="image/jpeg" OR $_FILES['fichier']['type'] =="image/pjpeg")
	$temp=$_FILES['fichier']['tmp_name'];
	$chemin="../images/articles/grandes/";
	$chemin_vignette="../images/articles/petites/";
	$nom_file= $last_id.$ext;
	$destination=$chemin.$nom_file;
	$destination_vignette = $chemin_vignette.$nom_file;
 
	move_uploaded_file($temp,$destination);
//redimension image
	$max_width = 600;
	$max_height = 600;
 
	$file=$destination;
 
	$size=getimagesize($file);
	$width=$size[0];
	$height=$size[1];
 
	$x_ratio=$max_width/$width;
	$y_ratio=$max_height/$height;
 
	if (($width <= $max_width) && ($height <= $max_height))
	{
		$tn_width=$width;
		$tn_height=$height;
	}
	else if (($x_ratio * $height) < $max_height)
	{
		$tn_height = ceil($x_ratio * $height);
		$tn_width = $max_width;
	}
	else {
		$tn_width = ceil($y_ratio * $width);
		$tn_height = $max_height;
	}
 
	$src = imagecreatefromjpeg($file);
	$dst = imagecreatetruecolor($tn_width,$tn_height);
	//imagecreatetruecolor
	imagecopyresized($dst,$src,0,0,0,0,$tn_width,$tn_height,$width,$height);
	//header("content-type: image/jpeg");
	$couleurgris = imagecolorallocate($dst, 125, 125, 125);
	imagestring($dst, 2, 2, 2, "", $couleurgris);
	imagejpeg($dst,$file, 100); //écrit l'image réduite sur le serveur
	//imagejpeg($dst, null, -1); //renvoie l'image au navigateur
	imagedestroy($src);
	imagedestroy($dst);
	///chmod($destination,0707);
 
	//redimension vignette
 
	$max_width = 150;
	$max_height = 200;
 
	$file=$destination;
	$sortie = $destination_vignette;
 
	$size=getimagesize($file);
	$width=$size[0];
	$height=$size[1];
 
	$x_ratio=$max_width/$width;
	$y_ratio=$max_height/$height;
 
	if (($width <= $max_width) && ($height <= $max_height))
	{
		$tn_width=$width;
		$tn_height=$height;
	}
	else if (($x_ratio * $height) < $max_height)
	{
		$tn_height = ceil($x_ratio * $height);
		$tn_width = $max_width;
	}
	else {
		$tn_width = ceil($y_ratio * $width);
		$tn_height = $max_height;
	}
 
	$src = imagecreatefromjpeg($file);
	$dst = imagecreatetruecolor($tn_width,$tn_height);
	//imagecreatetruecolor
	imagecopyresized($dst,$src,0,0,0,0,$tn_width,$tn_height,$width,$height);
	//header("content-type: image/jpeg");
	$couleurgris = imagecolorallocate($dst, 125, 125, 125);
	imagestring($dst, 2, 2, 2, "", $couleurgris);
	imagejpeg($dst,$sortie, 100); //écrit l'image réduite sur le serveur
	//imagejpeg($dst, null, -1); //renvoie l'image au navigateur
	imagedestroy($src);
	imagedestroy($dst);
	//chmod($destination,0707);
 
 
 
}
else{
echo "Erreur lors de l'envoie";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Administration</title>
<link href="styles.css" rel="stylesheet" type="text/css" media="screen" />
</head>
 
<body>
	<div id="general">
   	  <h1>Bienvenue dans l'administration de votre site internet !</h1>
      <ul id="menu">
      <li><a href="gestion_chaussure.php">Administration</a></li>
 
      </ul>
 
      <div id="gestion">
      <h2>Ajouter un article:</h2>
      <form action="<?php echo $editFormAction; ?>" name="ajout" method="POST" enctype="multipart/form-data" id="ajout">
      		<p>Famille : <select name="famille" id="famille">
      		  <option value="chaussures-dame">chaussures-dame</option>
      		  <option value="accessoires">accessoires</option>
      		  <option value="pret-a-porter-dame">pret-a-porter-dame</option>
      		  <option value="articles-cadeaux">articles-cadeaux</option>
      		</select>     		  
      		  </p>
              <p>Catégorie : <select name="id_categorie" id="id_categorie">
                <?php
do {  
?>
                <option value="<?php echo $row_categories['id_categorie']?>"><?php echo $row_categories['categorie']?></option>
                <?php
} while ($row_categories = mysql_fetch_assoc($categories));
  $rows = mysql_num_rows($categories);
  if($rows > 0) {
      mysql_data_seek($categories, 0);
	  $row_categories = mysql_fetch_assoc($categories);
  }
?>
              </select></p>
 
              <p>Prix : <input name="prix" type="text" id="prix" /></p>
              <p>Statut promo : <select name="statut_promo" id="statut_promo">
                <option value="OFF">OFF</option>
                <option value="ON">ON</option>
        </select></p>
              <p>Prix promo : <input name="px_promo" type="text" id="px_promo" /></p>
              <p>Nouveauté : <select name="nouveau" id="nouveau">
                <option value=" "> </option>
                <option value="New">New</option>
        </select></p>
              <p>Description : <textarea name="desc" cols="50" rows="5" id="desc"></textarea></p>
            <p>Photo : <input name="fichier" type="file" id="fichier" />
</p>
            <p><input name="Valider" type="submit" id="Valider" value="Valider" /></p>
            <input type="hidden" name="MM_insert" value="ajout" />
      </form>
      </div>
 
</div><!--ferme general -->
</body>
</html>
<?php
mysql_free_result($categorie_chaussure);
 
mysql_free_result($categories);
?>
message d'erreur

Warning: getimagesize(../images/articles/grandes/0): failed to open stream: No such file or directory in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 150 Warning: Division by zero in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 154 Warning: Division by zero in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 155 Warning: imagecreatefromjpeg(../images/articles/grandes/0): failed to open stream: No such file or directory in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 172 Warning: imagecreatetruecolor(): Invalid image dimensions in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 173 Warning: imagecopyresized() expects parameter 1 to be resource, boolean given in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 175 Warning: imagecolorallocate() expects parameter 1 to be resource, boolean given in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 177 Warning: imagestring() expects parameter 1 to be resource, boolean given in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 178 Warning: imagejpeg() expects parameter 1 to be resource, boolean given in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 179 Warning: imagedestroy() expects parameter 1 to be resource, boolean given in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 181 Warning: imagedestroy() expects parameter 1 to be resource, boolean given in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 182 Warning: getimagesize(../images/articles/grandes/0): failed to open stream: No such file or directory in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 193 Warning: Division by zero in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 197 Warning: Division by zero in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 198 Warning: imagecreatefromjpeg(../images/articles/grandes/0): failed to open stream: No such file or directory in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 215 Warning: imagecreatetruecolor(): Invalid image dimensions in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 216 Warning: imagecopyresized() expects parameter 1 to be resource, boolean given in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 218 Warning: imagecolorallocate() expects parameter 1 to be resource, boolean given in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 220 Warning: imagestring() expects parameter 1 to be resource, boolean given in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 221 Warning: imagejpeg() expects parameter 1 to be resource, boolean given in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 222 Warning: imagedestroy() expects parameter 1 to be resource, boolean given in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 224 Warning: imagedestroy() expects parameter 1 to be resource, boolean given in /customers/8/e/2/chezya-ya.be/httpd.www/ya-ya-admin/chaussure_ajout.php on line 225
En espérant trouver l'aide tant espérée je remercie par avance ceux qui m'aideront