note 59730 deleted from function.move-uploaded-file by cmb

From: Date: Mon, 08 Apr 2019 06:36:49 +0000
Subject: note 59730 deleted from function.move-uploaded-file by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-210558@lists.php.net to get a copy of this message
Note Submitter: nouncad at mayetlite dot com ---- Great!! my first note here... This function upload a file. If file exist, create a copy as "filename[n].ext" <?php function subirFichero($origen, $destinoDir, $ftemporal) { $origen = strtolower(basename($origen)); $destinoFull = $destinoDir.$origen; $frand = $origen; $i = 1; while (file_exists( $destinoFull )) { $file_name = substr($origen, 0, strlen($origen)-4); $file_extension = substr($origen, strlen($origen)-4, strlen($origen)); $frand = $file_name."[$i]".$file_extension; $destinoFull = $destinoDir.$frand; $i++; } if (move_uploaded_file($ftemporal, $destinoFull)) return $frand; else return "0"; } ?>

« previous php.notes (#210558) next »