diff options
author | Kjartan Mannes <kjartan@2.no-reply.drupal.org> | 2004-01-29 11:39:22 +0000 |
---|---|---|
committer | Kjartan Mannes <kjartan@2.no-reply.drupal.org> | 2004-01-29 11:39:22 +0000 |
commit | 3a9625e2e3665c8ba019896dc7cef8e84e5965cd (patch) | |
tree | a7f6fe40520c1c2250306ff33cdd9821dead45f4 | |
parent | c8daca07d29ee006f34d7e4978d2f774a1d3da9b (diff) | |
download | brdo-3a9625e2e3665c8ba019896dc7cef8e84e5965cd.tar.gz brdo-3a9625e2e3665c8ba019896dc7cef8e84e5965cd.tar.bz2 |
- Fixing extension splitting (was using the first dot instead of the last one).
-rw-r--r-- | includes/file.inc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/includes/file.inc b/includes/file.inc index 1169b02ef..cd9761088 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -115,6 +115,7 @@ function file_check_upload($source) { */ function file_check_location($source, $directory = 0) { $source = realpath($source); + $directory = realpath($directory); if ($directory && strpos($source, $directory) !== 0) { return 0; } @@ -172,8 +173,9 @@ function file_copy(&$source, $dest = 0, $replace = 0) { if (file_exists($dest) && !$replace) { // Destination file already exists and we can't replace is so we try and // and find a new filename. - list($name, $ext) = explode('.', $basename, 2); - $ext = $ext ? ".$ext" : ''; + $pos = strrpos($basename, '.'); + $name = substr($basename, 0, $pos); + $ext = substr($basename, $pos); $counter = 0; do { $dest = $directory . FILE_SEPARATOR . $name .'_'. $counter++ . $ext; |