Skip to content

Commit

Permalink
Fix for #3
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew13 committed Mar 7, 2014
1 parent 7651e75 commit 831b936
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Andrew13/Cabinet/CabinetUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,13 @@ public function resolveFileName($folder, UploadedFile $file, $enableObfuscation=
}

if(static::$app['config']->get('cabinet::obfuscate_filenames') && $enableObfuscation) {
$file = basename($file->fileSystemName, $file->getClientOriginalExtension()) . '_' . md5( uniqid(mt_rand(), true) ) . '.' . $file->getClientOriginalExtension();
}
$fileName = basename($file->fileSystemName, $file->getClientOriginalExtension()) . '_' . md5( uniqid(mt_rand(), true) ) . '.' . $file->getClientOriginalExtension();
} else {
$fileName = $file->fileSystemName;
}

// If file exists append string and try again.
if (File::isFile($folder.$file->fileSystemName)) {
if (File::isFile($folder.$fileName)) {
// Default file postfix
$i = '0000';

Expand Down Expand Up @@ -328,4 +330,4 @@ public function cleanPath($path)

return $path;
}
}
}

0 comments on commit 831b936

Please sign in to comment.