Hi Raghu,
I tried your code but somehow it didn't work with me. Maybe I didn't get the path-thing right, but I changed the code somewhat and now I can upload a file into a directory 'files', which is located in the same directory as my upload-script. So far so good!
The problem is though I don't know how I can give the uploaded file the same name as the original. $blah is always C:WindowsTempPhp2 with me, so with my current script I get a file called php2. Is there a way to get this right?
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
<html>
<body>
<form enctype="multipart/form-data" method="post" action="<?php echo $PHP_SELF ?>">
<input type="File" name="blah" size="25"><br>
<input type="submit" name="submit" value="Upload">
</form>
<?php
if ($submit) {
$dir = "files";
$filename = basename($blah);
if (!copy($blah, $dir.$filename)) {
print( "Oops! Something went wrong!");
}
}
?>
</body>
</html>
[/code]
Mirax