move_uploaded_file() does not move file into destination directory on W2K server
Posted on 2004-08-03
We are using PHP on a W2K server as the front-end to MS SQL database.
A script is used to upload text and a picture (optional) from authorized clients via HTML into a MS SQL database for display on our intranet/extranet according to the following code sniglet:
$query="INSERT INTO News (date, subject, description, enteredby, modifieddate,
pic, picpath, Viewer)
$user = $Page->user;
$moddate = date("m/d/Y");
$succees = move_uploaded_file
if(!$success) echo("Upload unsuccessful!" . '<br>');
$success = move_uploaded_file
if (!$success) echo("Upload unsuccessful!" . '<br>');
$subject=str_replace("'", "''", $subject);
$descript=str_replace("'", "''", $descript);
$query.=" ('$date', '$subject', '$descript', '$user', '$moddate',
$thepic, '$userfile', '$aud')";
If a picture is included, it is uploaded to two different locations - one for our intranet and a www site. Each of the $success variables are assigned false even though the jpeg file successfully appears on the external website. However, the image upload to our intranet (ABNET) results in a box with an "X" in it. When I inspect the upload folder, it does not contain the appropriate jpeg file, and hence the missing image.
I have the following in my HTML:
<form enctype="multipart/form-data" action="update2.php" method=POST>
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
I've checked the W2K security on the upload folder (and entire path) and I am authorized to read, write and execute. I have tried to use copy($source, $dest) in place of move_uploaded_file() with the same result. I've also tried substituting $tmp_name for $name (and vice-versa) as arguments in the move_uploaded_file() statement to no avail. Something is preventing the transfer of the image from the temporary location to the final location but damn if I can figure it out. Please help - this is driving me bonkers.