RE: [PHP] file upload problem (cont.)

From: Date: Fri, 17 Nov 2000 22:37:15 +0000
Subject: RE: [PHP] file upload problem (cont.)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25970@lists.php.net to get a copy of this message
DUH! I guess I'll learn to read better one of these days. Thanks dude. For those that may be wondering the quick fix to this, <? ... $destination = "/usr/local/apache/htdocs/somedir/template/" . $HTTP_POST_FILES['userfile']['name']; move_uploaded_file($userfile,$destination); ?> -----Original Message----- From: Ignacio Vazquez-Abrams [mailto:ignacio@openservices.net] Sent: Friday, November 17, 2000 3:59 PM To: Michael Geier Cc: PHP Mailing List Subject: Re: [PHP] file upload problem (cont.) On Fri, 17 Nov 2000, Michael Geier wrote: > I know I just posted something like this, but the two replies (one from > Sascha) didn't solve the problem. > > I have a script from the php.net site: > > <html><body> > <font face="Arial,Helvetica,sans-serif" size="2"> > <form enctype="multipart/form-data" > action="<?print($PHP_SELF);?>" > method="POST"> > <INPUT TYPE="hidden" name="MAX_FILE_SIZE" > value="1000000"> > Send this file: <br> <input name="userfile" type="file"> > <input type="submit" value="Send File"> > </form> > <? > move_uploaded_file($userfile, > "/usr/local/apache/htdocs/somedir/template/"); > // plan on doing some 'if_file()' checking here after transfer to make sure > it exists > ?> > </body></html> > > > # ls -l /usr/local/apache/htdocs/somedir/ > -rwxrwxrwx 1 nobody nobody 5026 Nov 16 14:18 index.php > -rwxrwxrwx 1 nobody nobody 509 Nov 16 14:18 preview.php > drwxrwxrwx 2 nobody nobody 4096 Nov 16 14:53 template > -rwxrwxrwx 1 nobody nobody 956 Nov 16 14:59 upload.php > > > I get the following errors when submitting the form: > > Warning: Unable to create '/usr/local/apache/htdocs/somedir/template/': Is > a directory in /usr/local/apache/htdocs/somedir/upload.php on line 32 > Warning: Unable to move '/tmp/php3K8BLT' to > '/usr/local/apache/htdocs/somedir/template/' in > /usr/local/apache/htdocs/somedir/upload.php on line 32 > > (line 32 is the move_uploaded_file() line) > > System specs: > RedHat 6.2 > Apache 1.3.14 > php 4.03pl1 > - php.ini[upload_tmp_dir] = "/tmp" > > my questions: > - why is it trying to create a directory? > - why can it not move the file since the directory is there and owned by > the correct user (nobody)? > - is there another way around this? > > Thanks. > Michael Geier > mgeier@cdmsports.com > It's not trying to create a directory; it's trying to create a file that has the name of a file that already exists. If you look at the documentation for move_uploaded_file(), the destination must also be a file. -- Ignacio Vazquez-Abrams <ignacio@openservices.net> -- 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

« previous php.general (#25970) next »