RE: [PHP] file upload

From: Date: Mon, 02 Jul 2001 14:19:16 +0000
Subject: RE: [PHP] file upload
Groups: php.general 
Request: Send a blank email to php-general+get-55837@lists.php.net to get a copy of this message
Try this: --------------upload.php---------- <?php if (is_uploaded_file($userfile)) { move_uploaded_file($userfile, "$new_location/$userfile_name"); } else { echo "Possible file upload attack: filename '$userfile'."; } ?> > -----Original Message----- > From: Wilbert Enserink [mailto:wilbert@pdd.nl] > Sent: 2 iulie 2001 17:08 > To: php-general@lists.php.net > Subject: [PHP] file upload > > > > Hi all, > > i'm using php version 4.0.5 and i'm playing around with the > file upload command using form and script which i copied > from php.net > > Unfornunately the script is giving an error: > > > Warning: Unable to open '/tmp/phpmOSK48' for reading: No such > file or directory in /opt/guide/www.abc.de/upload/upload.php on line 8 > > Warning: Unable to move '/tmp/phpmOSK48' to '/tmp/phpmOSK48' > in /opt/guide/www.abc.de/upload/upload.php on line 8 > > anybody got a clue what i'm doing wrong here? > > Thanx in advance! > > Wilbert > > > -------------upload.html------------- > > <html> > <head> > </head> > <body> > <FORM ENCTYPE="multipart/form-data" ACTION="upload.php" METHOD=POST> > Send this file: <INPUT NAME="userfile" TYPE="file"> > <INPUT TYPE="submit" VALUE="Send File"> > </FORM> > </body> > </html> > > > --------------upload.php---------- > > <?php > if (is_uploaded_file($userfile)) { > copy($userfile, "$userfile"); > } else { > echo "Possible file upload attack: filename '$userfile'."; > } > /* ...or... */ > move_uploaded_file($userfile, "$userfile"); > ?> > > ------------------------- > Pas de Deux > Van Mierisstraat 25 > 2526 NM Den Haag > tel 070 4450855 > fax 070 4450852 > http://www.pdd.nl > info@pdd.nl > ------------------------- >

« previous php.general (#55837) next »