note 57665 deleted from features.file-upload by felipe
| From: | felipe@php.net | Date: | Sun, 30 Dec 2007 17:54:01 +0000 |
| Subject: | note 57665 deleted from features.file-upload by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134326@lists.php.net to get a copy of this message | ||
Note Submitter: ohdotoh at randomnoisebursts dot com
----
my quick and simple don't overwrite files that exist solution:
if (file_exists($sysfolder . '/' . $filename)) {
// append a digit to the beginning of the name
$tmpVar = 1;
while(file_exists($sysfolder . '/' . $tmpVar . '-' . $filename)) {
// and keep increasing it until we have a unique name
$tmpVar++;
}
$filename= $tmpVar . '-' . $filename;
}