From 7de585103f35dbcfbf9986ef78b0f6b50d213d33 Mon Sep 17 00:00:00 2001 From: Stig Lindqvist Date: Tue, 10 Jan 2012 14:02:19 +1300 Subject: [PATCH] BUGFIX: Can't upload files to root folder --- code/controllers/AssetAdmin.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code/controllers/AssetAdmin.php b/code/controllers/AssetAdmin.php index e1e0de63..00b8cd55 100644 --- a/code/controllers/AssetAdmin.php +++ b/code/controllers/AssetAdmin.php @@ -202,8 +202,11 @@ JS } $processedData = array_reverse($processedData); - if($data['FolderID'] && $data['FolderID'] != '') $folder = DataObject::get_by_id("Folder", $data['FolderID']); - else $folder = singleton('Folder'); + if(isset($data['FolderID']) && is_numeric($data['FolderID'])) { + $folder = DataObject::get_by_id("Folder", $data['FolderID']); + } else { + $folder = singleton('Folder'); + } foreach($processedFiles as $filePostId => $tmpFile) { if($tmpFile['error'] == UPLOAD_ERR_NO_TMP_DIR) {