Change name when file name contains more of a point MDL-6897 - patch submitted by Toni Mas; merged from MOODLE_17_STABLE

This commit is contained in:
skodak 2006-10-31 10:16:26 +00:00
parent 1a1f496681
commit 3c0f610636

View File

@ -301,7 +301,10 @@ class upload_manager {
* @todo verify return type - this function does not appear to return anything since $file is passed in by reference
*/
function handle_filename_collision($destination, &$file, $format='%s_%d.%s') {
$bits = explode('.', $file['name']);
$part1 = explode('.', $file['name']);
$bits = array();
$bits[1] = array_pop($part1);
$bits[0] = implode('.', $part1);
// check for collisions and append a nice numberydoo.
if (file_exists($destination .'/'. $file['name'])) {
$a->oldname = $file['name'];