RE: [PHP] file upload question
| From: | Ford, Mike [LSS] | Date: | Fri, 24 Jan 2003 17:24:57 +0000 |
| Subject: | RE: [PHP] file upload question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-133016@lists.php.net to get a copy of this message | ||
> -----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