Re: file upload problem (cont.)
| From: | Ignacio Vazquez-Abrams | Date: | Fri, 17 Nov 2000 21:58:38 +0000 |
| Subject: | Re: file upload problem (cont.) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-25965@lists.php.net to get a copy of this message | ||
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>