note 57665 deleted from features.file-upload by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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;
  }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.