Need some Help in PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
leacoco
Forum Newbie
Posts: 4
Joined: Mon Jan 12, 2004 4:01 am
Location: Hamburg

Need some Help in PHP

Post 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?
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post 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
leacoco
Forum Newbie
Posts: 4
Joined: Mon Jan 12, 2004 4:01 am
Location: Hamburg

Post by leacoco »

Thankss for that.I'ma try that out and see what i get.
Post Reply