Forum Moderators: coopster

Message Too Old, No Replies

function copy, with safe_mode enable

function copy with safe_mode enable

         

NightStudio

6:32 pm on May 12, 2004 (gmt 0)

10+ Year Member



Hi!

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

coopster

5:24 pm on May 13, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, NightStudio!

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]?

NightStudio

5:57 pm on May 13, 2004 (gmt 0)

10+ Year Member



I took a look to this list, so I have no ideas how this is work, safe_mode is realy new for me, where I can find some exemple?

coopster

6:07 pm on May 13, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I thought you might look into the part regarding the copy function on that page.
It may be a permission issue.


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)

NightStudio

10:37 pm on May 13, 2004 (gmt 0)

10+ Year Member



ho boy! ok ... how I can check who is the owner. I'm not familiar with unix command, I'm using WS FTP or Dreamweaver to upload my files on the remote server.