这是两个文件。当我点击提交没有任何反应。有一个print_r但它没有显示任何东西。对于表单操作,我把它留空,因为它在同一页面上。有人可以帮忙吗?提前谢谢。
<?php
// la function qui va changer l'image de profl du membre
function modifier_image_profile($avatar_tmp,$avatar)
{
move_uploaded_file($avatar_tmp,'avatar/'.$avatar);
mysql_query("UPDATE utilisateurs SET avatar='{$_FILES['avatar']['name']}' WHERE pseudo= '{$_SESSION['pseudo']}'");
}
?>
=============================================== =================
<?php
include ('functions/membre.func.php');
include ('body/header.php');
include ('body/menu.php');
?>
<h3> Changer votre image de profil</h3>
<?php
if (isset($_POST['submit'])){
$avatar=$_FILES['avatar']['name'];
$avatar_tmp=$_FILES['avatar']['tmp_name'];
$avatar="profile.jpg";
if (!empty($avatar))
{
$image_ext=strtolower(end(explode('.',$avatar)));
print_r($image_ext);
if(in_array($image_ext,array('jpg','jpeg','png','gif')))
{
modifier_image_profile($avatar_tmp,$avatar);
header("Location:index.php?page=membre");
}else{
echo "<div class='error'>Veuillez saisir une image valide</div>";
}
}
}
foreach ($infos as $info)
{
?>
<img src='avatar/<?php echo $info['avatar'];?>'height='100' width='100' alt='avatar'
<?php
}
?>
<form method='POST' action ='' enctype='multipart/form-data'>
<input type="file" name="avatar"><br/><br/>
<input type="submit" value="Valider" name="submit">
</form>