From 3d24079d15dc327a27070833d57beaf2529cfd61 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 9 Feb 2014 19:24:09 +1300 Subject: [PATCH] Use filtered file paths in upload (fixes #2836) --- filesystem/Upload.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/filesystem/Upload.php b/filesystem/Upload.php index 2233bb214..397542de3 100644 --- a/filesystem/Upload.php +++ b/filesystem/Upload.php @@ -129,17 +129,12 @@ class Upload extends Controller { $base = Director::baseFolder(); $parentFolder = Folder::find_or_make($folderPath); - // Create a folder for uploading. - if(!file_exists(ASSETS_PATH . "/" . $folderPath)){ - Filesystem::makeFolder(ASSETS_PATH . "/" . $folderPath); - } - // Generate default filename $nameFilter = FileNameFilter::create(); $file = $nameFilter->filter($tmpFile['name']); $fileName = basename($file); - $relativeFilePath = ASSETS_DIR . "/" . $folderPath . "/$fileName"; + $relativeFilePath = $parentFolder->getRelativePath() . "/$fileName"; // Create a new file record (or try to retrieve an existing one) if(!$this->file) {