Re: Uploading files without saving them
| From: | Daniel Brown | Date: | Mon, 23 Jun 2008 22:28:04 +0000 |
| Subject: | Re: Uploading files without saving them | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-275868@lists.php.net to get a copy of this message | ||
On Mon, Jun 23, 2008 at 6:05 PM, James Colannino <james@colannino.org> wrote:
>
> Ah, I see. What would happen if two people just happened to upload files
> with the same filename at the same time? Would one stomp over the other, or
> does PHP have mechanisms to handle that sort of situation?
Todd is correct. When you upload a file, it's saved to a
temporary directory with a unique filename. Thus, if six people
upload the file
summer.jpg, you may instead see on the server side:
/tmp/PHPf983D93j
/tmp/PHPOg4ji23
/tmp/PHPeklS83q
.... and so on.
Further, as Todd mentioned, unless you explicitly call
move_uploaded_files() or perform a similar action, the file will be
deleted as soon as the Apache child process dies --- which happens as
soon as script execution completes.
Keep in mind that this is all assuming that you're using Apache on
a *NIX-like system. If you're using IIS, Windows, or anything else,
your mileage may vary.
--
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.