Je voudrais envoyé une photo vers un dossier sur un blog que je développe mais la fonction move uploaded file ne marche pas sur ce server dédié.
Voilà le code:
CODE
<!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>Document sans titre</title>
</head>
<form action="test.php?photo=ok" enctype="multipart/form-data" method="post">
<input name="image" type="file" id="image" />
<input type="submit" />
</form>
<?PHP
if($_GET["photo"]="ok") {
$photoUploadTemp = $_FILES['image']["tmp_name"];
$photoUpload = addslashes($_FILES['image']["name"]);
$dossier = "./$photoUpload";
if(move_uploaded_file( $photoUploadTemp, $dossier)){
echo $dossier;
echo "ok";
}else{
echo "no";
}
}
?>
<body>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
</head>
<form action="test.php?photo=ok" enctype="multipart/form-data" method="post">
<input name="image" type="file" id="image" />
<input type="submit" />
</form>
<?PHP
if($_GET["photo"]="ok") {
$photoUploadTemp = $_FILES['image']["tmp_name"];
$photoUpload = addslashes($_FILES['image']["name"]);
$dossier = "./$photoUpload";
if(move_uploaded_file( $photoUploadTemp, $dossier)){
echo $dossier;
echo "ok";
}else{
echo "no";
}
}
?>
<body>
</body>
</html>
Et voilà le mesage d'erreur:
CITATION
Warning: move_uploaded_file(./medium_dsc00142.jpg): failed to open stream: Permission denied in /home/costados/www/lacosta/test/test.php on line 16
Warning: move_uploaded_file(): Unable to move '/tmp/phpwICKyg' to './medium_dsc00142.jpg' in /home/costados/www/lacosta/test/test.php on line 16
Warning: move_uploaded_file(): Unable to move '/tmp/phpwICKyg' to './medium_dsc00142.jpg' in /home/costados/www/lacosta/test/test.php on line 16
La ligne 16 correspond à "if(move_uploaded_file( $photoUploadTemp, $dossier)){"
Est-ce que qqn saurait ce qu'il faudrait faire ?
Merci
