Re: file upload

From: Date: Mon, 02 Jul 2001 14:35:53 +0000
Subject: Re: file upload
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-55839@lists.php.net to get a copy of this message
thanx adrian. I humbly bow for da masta :-] Wilbert ----- Original Message ----- From: Adrian Ciutureanu <adrian.ciutureanu@softure.com> To: Wilbert Enserink <wilbert@pdd.nl> Cc: <php-general@lists.php.net> Sent: Monday, July 02, 2001 4:19 PM Subject: RE: [PHP] file upload > 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 > > ------------------------- > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net ------------------------- 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 (#55839) next »