hi friend
heres the code to upload a file on the server
using a form
the code follows here
//////////////////////
<HEAD>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<?
if ($Init==0)
{
// Hello, dont forget to put ( enctype="multipart/form-data" ) in ur form tag 'coz if ur code is working and u
// ignore this clause it wont upload the file
?>
<form method="post" action="<? echo $PHP_SELF; ?>" enctype="multipart/form-data">
<input type="file" name="fileToBeUploaded">
<INPUT TYPE="hidden" name=Init value=1>
<input type=submit value="upload file">
</form>
<?
}
elseif ($Init==1)
{
// this line will display the file name where the file is uploaded from
// client machine to the server it will temporary copy the files to a temp folder
echo "fileToBeUploaded : $fileToBeUploaded1<br>";
echo "fileToBeUploaded_name : $fileToBeUploaded1_name<br>";
// put the destination where u wanna upload the file in my case i want it to uploaded in /www/htdocs folder
$dest="/www/htdocs/".$fileToBeUploaded1_name;
echo $dest;
// actual copying of file is done here it copies from the temp folder to the actual folder
if (!copy($fileToBeUploaded,$dest))
{
echo "failed to copy<br> ";
echo "$fileToBeUploaded<br>";
echo "$fileToBeUploaded_name<br>";
}
else
{
echo "Sucessfully uploaded ";
echo "$fileToBeUploaded<br>";
echo "$fileToBeUploaded_name<br>";
}
}
?>
</body>
//////////////////////
if ya still find problem
mail me at dipenmistry@rediffmail.com
dips