hi i create a form to uploads files (photos) when i try to put some rules for type and size of files that should be upload "if size or type error exist go to page cadeaux.php + a variable ?error=ok" but thats dosn't works. normaly if submit is isset it should take me to other page what ever is the result her is the code:
<?php
//--connection-mysql---
require_once("\includes\connect.inc.php");
//--selection base de donnee
mysql_select_db("tombola");
//---requete modification---
if (isset($_POST['submit']))
{
if(isset($_FILES['image']['tmp_name']) && $_FILES['image']['error']==0 )
{
$folder="images/";
$file_temp=$_FILES['image']['tmp_name'];
$file_name=basename($_FILES['image']['name']);
[COLOR="SandyBrown"]$extentions=array('.jpg', '.png', '.jpeg', '.gif');
$extention=strrchr($file_name, '.');
$max_taille=10485760;
$file_taille=filesize($file_temp);
if ((!in_array($extention, $extentions)) && ($fille_taille > $max_taille))
{
//--vers page cadeaux
header("location:cadeaux.php?erreur=ok");
}[/COLOR]
else
{
move_uploaded_file($file_temp, $folder.$file_name);
if ($_FILES['image']['error']==0)
{
$modif="UPDATE cadeaux SET designation = '".$_POST['desi']."' , argent = '".$_POST['argent']."' , somme = '".$_POST['somme']."', photo = '".$folder.$file_name."' WHERE id='".$_POST['id']."' " ;
mysql_query($modif);
//--vers page cadeaux
header("location:cadeaux.php?");
}
}
}
else
{
$modif="UPDATE cadeaux SET designation = '".$_POST['desi']."' , argent = '".$_POST['argent']."' , somme = '".$_POST['somme']."' WHERE id='".$_POST['id']."' " ;
mysql_query($modif);
//--vers page cadeaux
header("location:cadeaux.php");
}
}
//---requete trouver l'enregistrement---
$select1="SELECT * FROM `cadeaux` WHERE `id`='".$_GET['ref']."' ";
$requete1=mysql_query($select1);
$row1=mysql_fetch_array($requete1);
//--head html--
include("\includes\head.inc.php");
?>
<title>Accueil administration site Tombola</title>
</head>
<body>
<div id="container">
<div id="header">
<h1>Administration site Tombola</h1>
</div><!--#header-->
<?php
//---menu----
include("/includes/menu.php");
?>
<div id="body">
<h2>Modification des enregistrement cadeaux</h2>
<p>Vous pouvez modifier les informations concernant l'enregistrement N° <?php echo $_GET['ref']; ?></p>
<table class="modif">
<form name="modifier" enctype="multipart/form-data" method="post" action="modifier.php">
<tr>
<td><label for="desi">Designation : </label></td>
<td><input type="text" name="desi" id="desi" value="<?php echo $row1['designation']; ?>" /> <input type="hidden" name="id" value="<?php echo $row1['id']; ?>"/></td>
<td><p class="instruction">Designation ou dscription du cadeaux ne doit pas contenir plus de 100 charachtere</p></td>
</tr>
<tr>
<td><label for="argent"> Argent? </label></td>
<td><input type="text" name="argent" id="argent" value="<?php echo $row1['argent']; ?>"/></td>
<td><p class="instruction">Argent si le cadeaux a gagnier ete une somme d'argent entrez 1 si non 0</p></td>
</tr>
<tr>
<td><label for="somme">Somme : </label></td>
<td><input type="text" name="somme" id="somme" value="<?php echo $row1['somme']; ?>"/></td>
<td><p class="instruction">a somme d'argent si le cadaux ete de l'argent</p></td>
</tr>
<tr>
<td><label for="image"> Image : </label></td>
<td><input type="file" name="image" id="image" /></td>
<td> <img src="<?php echo $row1['photo']; ?>"/> </td>
</tr>
<tr><td colspan=3><input type="submit" name="submit" value="Modifier"/></td></tr>
</form>
</table>
<?php
//---footer---
include('includes/end.inc.php');
?>
thanks