Page 1 of 1

Need some Help in PHP

Posted: Mon Jan 12, 2004 4:01 am
by leacoco
HI i am new in php and i have a problem whenever i write some php codes and execute them.
Example:

<?
if($File){
print("$File_name\n");
if(copy($File,"users/$File_name")){
print("Successful\n");}else
{
print("not successful\n");
}
unlink($File);
}
print("upload file to the server\n");
print("<form action=\"Fileupload.php\" method=post enctype=\"multipart/form-data\">\n");
print("File<input type=File name=\"File\" size=20>\n);
print("<input type=submit name=\"submit\" value=\"submit\"></form>\n");
?>

So when i run this, i get the message

NOTICE: Undefined variable : File in c:\webdocs\Fileupload.php on line 6.

Please can someone help me?

Posted: Mon Jan 12, 2004 5:35 am
by JayBird
might need to add this to the begining of your script

Code: Select all

$File = $_POST["File"];
Also, where is $File_name being set?

Mark

Posted: Mon Jan 12, 2004 7:43 am
by leacoco
Thankss for that.I'ma try that out and see what i get.