From: Christian Weiske Date: Wed, 4 Apr 2012 16:00:17 +0000 (+0200) Subject: automatically add file extension to new files when it has no extension X-Git-Tag: v0.1.0~53 X-Git-Url: https://git.cweiske.de/phorkie.git/commitdiff_plain/b7064cd463c2f90cd30f25add6456ea23572661a?hp=e19023b3127d8d2ef7bcea338b99d849b73b2c5b automatically add file extension to new files when it has no extension --- diff --git a/src/phorkie/Repository/Post.php b/src/phorkie/Repository/Post.php index 1b60752..b9d9be5 100644 --- a/src/phorkie/Repository/Post.php +++ b/src/phorkie/Repository/Post.php @@ -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