RE: [PHP] file upload question
| From: | Mark Heintz PHP Mailing Lists | Date: | Fri, 24 Jan 2003 19:09:49 +0000 |
| Subject: | RE: [PHP] file upload question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-133029@lists.php.net to get a copy of this message | ||
You have to include a filename along with the path when you're using
move_uploaded_file(); if you're only specifying
'/usr/local/etc/httpd/htdocs/blast/images' as your destination string, php
is trying to create a file named 'images' in
'/usr/local/etc/httpd/htdocs/blast'. If there's still a problem,
the user that your webserver (and therefore php, in most cases) runs as
may not have write permission to the directory you're trying to move to.
Make sure the webserver can write to the destination directory.
mh.
On Fri, 24 Jan 2003, Andrew Rench wrote:
> thanks for the advice- this makes sense as to why I'm not seeing the file. I added the
> move_uploaded_file() to the script to see what happens and I end up getting the following
> error:
> PHP Warning: Unable to move '/var/tmp/phpfcwVyC' to
> '/usr/local/etc/httpd/htdocs/blast/images' in
> /usr/local/etc/httpd/htdocs/blast/upload_test2.php on line 10
>
> Am I setting the path wrong? Should it be relative to the 'upload_test2.php' file?
>
> thanks
>
> --- "Ford, Mike [LSS]" <M.Ford@lmu.ac.uk> wrote:
> > > -----Original Message-----
> > > From: Andrew Rench [mailto:andrewrench@yahoo.com]
> > > Sent: 24 January 2003 17:05
> > >
> > > the following code:
> > >
> > > <html>
> > > <body>
> > > <form enctype="multipart/form-data" action="<?= $PHP_SELF
> > > ?>" method
> > > ="post">
> > > <input type="hidden" name="MAX_FILE_SIZE"
> > > value="1000">
> > > Send this file: <input name="userfile" type="file">
> > > <input type="submit" value="Send File">
> > > </form>
> > > <?php
> > > echo $_FILES['userfile']['tmp_name'];
> > > ?>
> > > </body>
> > > </html>
> > >
> > > produces the following after upload:
> > >
> > > /var/tmp/phplSTEVp (or php[something-or-other])
> > >
> > > When I view that directory, it is empty.
> >
> > When you upload a file, the file PHP puts it in is a temporary file -- hence the
> > ['tmp_name']
> > key -- which is your /var/tmp/php??????. Because it's a temporary file, PHP
> > automatically
> > deletes it when the script ends. If you haven't done something with it in the script
> > (such as
> > move_uploaded_file() it), it's gone forever.
> >
> > Cheers!
> >
> > Mike
> >
> > ---------------------------------------------------------------------
> > Mike Ford, Electronic Information Services Adviser,
> > Learning Support Services, Learning & Information Services,
> > JG125, James Graham Building, Leeds Metropolitan University,
> > Beckett Park, LEEDS, LS6 3QS, United Kingdom
> > Email: m.ford@lmu.ac.uk
> > Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>