uploaded files - if they already exist?

uploaded files - if they already exist?

am 09.01.2008 12:49:31 von jodleren

Hi!

When a file is uploaded, using , I get it as a temp-
file.
Will it stay there, so I can check the user whether to overwrite an
existing file?

WBR
Sonnich

Re: uploaded files - if they already exist?

am 09.01.2008 12:57:48 von Janwillem Borleffs

jodleren schreef:
> When a file is uploaded, using , I get it as a temp-
> file.
> Will it stay there, so I can check the user whether to overwrite an
> existing file?
>

These file names are unique, meaning that you can upload the same file
over and over again without any conflicts.

If you want to check for duplicate uploads, you should check the file
name and/or the md5 hash (through md5_file).


JW

Re: uploaded files - if they already exist?

am 09.01.2008 13:00:31 von Janwillem Borleffs

Janwillem Borleffs schreef:
> If you want to check for duplicate uploads, you should check the file
> name and/or the md5 hash (through md5_file).
>

To clarify; with file name here I mean the "name" key in the $_FILES array.


JW

Re: uploaded files - if they already exist?

am 09.01.2008 13:08:44 von Erwin Moller

jodleren wrote:
> Hi!
>
> When a file is uploaded, using , I get it as a temp-
> file.
> Will it stay there, so I can check the user whether to overwrite an
> existing file?

No, they won't stay there.
If you do not use move_uploaded_file(), the tempfile will be deleted
when the scripts ends.

And the filenames are unique as JanWillem described, so you don't have
to worry about that.

So it is up to you (your script) to move the temp file from the temp dir
to a better place.

Regards,
Erwin Moller

>
> WBR
> Sonnich