Hey!
Thanks for helping out.
I finally got this working on my Windows NT and Win2k boxes. I'm now battling with my ISP to get support on getting it working on their box :-(
Anyway, for anyone else who's interested, I thought I'd show you my code:
This is the form that posts the file:
<html><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- Creation date: 02/10/2002 -->
<body>
<form ENCTYPE="multipart/form-data" method="POST" action="./file_process.php">
File:<INPUT TYPE="FILE" NAME="f_logo" SIZE="35">
<input type="hidden" name="MAX_FILE_SIZE" value="10000000">
<input type="submit" value="Upload" name="B1">
Please click only <b>once</b> and wait for confirmation
</form>
</body>
</html>
..and this is the file that processes the upload (it renames the uploaded file if it already exists in the destination directory!):
<html><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- Creation date: 02/10/2002 -->
<body>
<?php
if ( file_exists($HTTP_POST_FILES['f_logo'] ['tmp_name']))
{
echo "<div align='center'><h3>File appears to have got to temp dir OK</h3></div><br>";
$filename=$_FILES['f_logo']['name'];
echo "Filename is: " . $filename . "<br>";
$tmp_name=$HTTP_POST_FILES['f_logo']['tmp_name'];
echo "Filename is: " . $tmp_name . "<br>";
$destinationpath="c://php//upload//".$filename;
$i = 1;
while (file_exists($destinationpath))
{
$destinationpath=$destinationpath.".".$i++;
echo "desinationpath is: ".$destinationpath;
}
if (move_uploaded_file($tmp_name, $destinationpath) )
{
echo "<div align='center'><h3>File moved successfully</h3></div><br>";
echo "<div align='center'><h3>Operation completed successfully<!/h3></div><br>";
}
else
{
echo "<div align='center'><h3>Moving the file failed!</h3></div><br>";
}
}
else
{
echo "HTTP POST failed. Perhaps the server is not set up?";
}
?>
</body>
</html>
.......................................................
I hope that somebody finds it useful!!
๐