By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,401 Members | 814 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,401 IT Pros & Developers. It's quick & easy.

uploaded files - if they already exist?

P: n/a
Hi!

When a file is uploaded, using <input type=file>, 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
Jan 9 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
jodleren schreef:
When a file is uploaded, using <input type=file>, 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
Jan 9 '08 #2

P: n/a
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
Jan 9 '08 #3

P: n/a
jodleren wrote:
Hi!

When a file is uploaded, using <input type=file>, 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
Jan 9 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.