Skip to content

Commit

Permalink
Use filtered file paths in upload (fixes #2836)
Browse files Browse the repository at this point in the history
  • Loading branch information
chillu committed Feb 9, 2014
1 parent caaf286 commit 3d24079
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions filesystem/Upload.php
Expand Up @@ -129,17 +129,12 @@ public function load($tmpFile, $folderPath = false) {
$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) {
Expand Down

0 comments on commit 3d24079

Please sign in to comment.