bonjour,

voila mon script

up.php (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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Upload Song</title>
</head>
 
<body>
<h2>::: Upload Song :::</h2>
<hr>
<form action="upload.php" enctype="multipart/form-data">
<table>
<tr>
<td>Movie : </td><td><input type="text" name"movie" value="<?php print($movie); ?>" /></td><br />
</tr>
<tr>
<td>Song : </td><td><input type="text" name="song" value="<?php print($song); ?>" /></td><br />
</tr>
<tr>
<td>Image : </td><td><input type="file" name="image" value="<?php print($image); ?>" /></td><br />
</tr>
<td>Song url : </td><td><input type="text" name="songurl" value="<?php print($songurl); ?>" /></td><br />
</table>
<input type="submit" name="submit" value="envoyer" />
</form>
</body>
</html>


upload.php

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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>UPLOAD</title>
</head>
 
<body>
<?PHP
require ("connect.php");
 
$movie=$_REQUEST["movie"];
  $song=$_REQUEST["song"];
  $songurl=$_REQUEST["songurl"];
 
if ($_REQUEST["submit"]!=""){
  if(empty($movie)||empty($song)||empty($songurl)) 
      die("ERREUR : tous les champs doivent être remplis.");
if (is_uploaded_file($_FILES['image']['tmp_name'])){
    move_uploaded_file($_FILES['image']['tmp_name'],'images/'.$_FILES['image']['name']);
    echo "<img src=images/".$_FILES['image']['name'].">";
    $image='images/'.$_FILES['image']['name'];
  }else{die ("Problème d'envoi de fichier [image]");}
 
$liendb = mysql_connect("$host", "login", "password");
mysql_select_db("$db");  
$sql = "INSERT INTO tamilxtreme (movie, song, image, url) ";
$sql.= " VALUES ('$movie', '$song', '$image', '$url')";
mysql_query($sql);
 echo "$movie, $song, $image, $url => ajouté sans probleme";
  mysql_close($liendb);
}
  ?>
</body>
</html>

le problem c'est qu'il ne vaut pas marcher il m'affiche ""ERREUR : tous les champs doivent être remplis."