automatically add file extension to new files when it has no extension
authorChristian Weiske <cweiske@cweiske.de>
Wed, 4 Apr 2012 16:00:17 +0000 (18:00 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Wed, 4 Apr 2012 16:00:17 +0000 (18:00 +0200)
src/phorkie/Repository/Post.php

index 1b60752..b9d9be5 100644 (file)
@@ -48,6 +48,10 @@ class Repository_Post
             if (!isset($orignalName) || $orignalName == '') {
                 //new file
                 $bNew = true;
+                if (strpos($name, '.') === false) {
+                    //automatically append file extension if none is there
+                    $name .= '.' . $arFile['type'];
+                }
             } else if (!$this->repo->hasFile($orignalName)) {
                 //unknown file
                 //FIXME: Show error message