Forum Moderators: coopster
Here is a script who working fine to upload a file in a specific directory on a server, so now, I have to make working this script with safe_mode enable on another server. Any ideas what I have to modify?
the script :
<html>
<head>
<title>Ajout Photo 12</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="ns.css" rel="stylesheet" type="text/css">
</head>
<?
if ($submit) {
// CONNECT TO DB
require("connect.php");
// L'utilisateur a envoyé un fichier et les données sont correctes : ajout du fichier
// Renommage du fichier
$fichier_final = ereg_replace(" ","_",$lefichier_name);
//copie du fichier vers le repertoire images
copy($lefichier, "$destination/$fichier_final");
// Ajout à la table des fichiers
mysql_query("UPDATE photo SET fichier = 'images/$fichier_final', description = '$description' WHERE id = 12")
or die ("Could not successfully run query from DB: " . mysql_error());
echo "<body bgcolor=242A91>";
echo "<font color=white>L'image à été mise à jour - <a href=index.php>retour au menu photos</a>";
exit();
}
else {
require("connect.php");
?>
<body bgcolor="#242A91">
<p><font color="#FFFFFF" size="-1" face="Verdana, Arial, Helvetica, sans-serif">Ajout
de la photo 12</font></p>
<form method="post" action="<?php echo $PHP_SELF;?>" enctype="multipart/form-data">
<p><font color="#FFFFFF" size="-1" face="Verdana, Arial, Helvetica, sans-serif"> Description :
<input type="text" name="description">
</font></p>
<p><font color="#FFFFFF" size="-1" face="Verdana, Arial, Helvetica, sans-serif">Fichier :
<input type="file" name="lefichier">
<br>
<br>
<input type="submit" name="submit" value="Envoyer">
</font> </p>
</form>
<?
}
?>
</body>
</html>
-----
PS : the $destination var is in my connect.php, it's just the absolute path to point on the directory where I want to upload the file.
Thanks
Have you checked to see if you are meeting the limitations of the
copy()function set by Functions restricted/disabled by safe mode [php.net]?
Checks whether the files or directories you are about to operate on have the same UID (owner) as the script that is being executed. Checks whether the directory in which you are about to operate has the same UID (owner) as the script that is being executed. (on source and target)