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
| <!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></title>
</head>
<body>
<?php
include("connect_base.php");
mysql_query("SET NAMES UTF8");
if(isset($_POST['submit'])){
if(empty($_POST['titre']) || empty($_POST['description']) || empty($_POST['id_cat']) || empty($_FILES['video']['name']))
{
echo "<br><strong><font color=\"#FF0000\">Saisir toutes les données</font></strong>";
}
else{
$video=$_FILES["video"]["name"];
echo $video;
//$chemin= $_POST["video"];
$titre=$_POST['titre'];
$description=$_POST['description'];
$id_cat=$_POST['id_cat'];
$target="videos/";
$target=$target.basename($_FILES['video']['name']);
if(move_uploaded_file($_FILES['video']['tmp_name'],$target)){
echo "<strong><font color=\"#FF0000\"><br>". basename($_FILES['video']['name'])." has been upload</font></strong>";
}else{
echo "<strong><font color=\"#FF0000\"><br>non upload</font><strong>";
}
$sql=mysql_query("INSERT INTO video(ID_VIDEO,ID_CAT,TITRE_VIDEO,DESCRIPTION_VIDEO,PATH)VALUES(\"\", \"$id_cat\",\"$titre\", \"$description\",\"$target\")");
if(!$sql)
echo('<br>Erreur SQL !<br>'.mysql_error());
else echo "<strong><font color=\"#00FF66\"><br>La requete est bien exécuté</font></strong>";
}
}
?>
<form enctype="multipart/form-data" action="" method="post">
<br />
<table width="418">
<tr>
<td width="173" colspan="2" height="40"><strong><center>Ajout d'une vidéo </center></strong></td>
</tr>
<tr>
<td>Upload video</td>
<td><label for="video"></label>
<input type="file" name="video" id="video" />
<input type="hidden" name="MAX_FILE_SIZE" value="20000000000000" />
</td>
</tr>
<tr>
<td >Titre</td>
<td><label for="titre"></label>
<textarea name="titre" id="titre" cols="30" rows="2"></textarea></td>
</tr>
<tr>
<td valign="top">Description</td>
<td><label for="description"></label>
<textarea name="description" id="description" cols="30" rows="5"></textarea></td>
</tr>
<tr>
<td>Sous catégorie</td>
<td>
<?php
$sql=mysql_query("SELECT * FROM categorie");
?>
<label for="categorie"></label>
<select name="id_cat" id="id_cat">
<?php
while($cat_rows=mysql_fetch_assoc($sql)){
?>
<option value="<?php echo $cat_rows['ID_CAT'];?>"><?php echo $cat_rows['SOUS_CAT'];?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td> </td>
<td>
<input type="submit" name="submit" id="submit" value="Ajouter" />
</td>
</tr>
</table>
</form>
</body>
</html> |
Partager