Re: uploading a file via php - i need some simple code

From: Date: Wed, 03 Jul 2002 17:26:25 +0000
Subject: Re: uploading a file via php - i need some simple code
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-105249@lists.php.net to get a copy of this message
Read http://www.php.net/manual/en/features.file-upload.php On Wed, 3 Jul 2002, Phil Schwarzmann wrote: > I am having the worst trouble trying to write a tiny simple script that > will upload a file. Below is my code - can anyone tell me why it's not > working.... > > HTML > > <form name="form1" method="post" action="upload.php" > enctype="multipart/form-data"> > <input type="hidden" name="MAX_FILE_SIZE" value="1000"> > <input type="file" name="userfile"> > <input type="submit" name="Submit" value="Submit"> > </form> > > PHP (upload.php) > > $filename = "/test.txt"; > if (!move_uploaded_file($userfile, $filename)) > { > echo "something barfed."; > exit; > } > > else > { > echo "uploaded."; > } > > Something is most likely wrong with the $filename variable. I don't > know what exactly to put in there. All I want to do is upload a file > and then move/copy it to a specific directory. > > What am I doing wrong?!?! > > THANKS!! >

« previous php.general (#105249) next »