mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #1731 from trewq/asset-upload-directory-fix
Fix error when uploading file and ASSETS_DIR is a subdirectory
This commit is contained in:
commit
ac6083c9a2
@ -68,7 +68,7 @@ class CMSFileAddController extends LeftAndMain {
|
||||
|
||||
if($folder->exists() && $folder->getFilename()) {
|
||||
// The Upload class expects a folder relative *within* assets/
|
||||
$path = preg_replace('/^' . ASSETS_DIR . '\//', '', $folder->getFilename());
|
||||
$path = preg_replace('/^' . preg_quote(ASSETS_DIR, '/') . '\//', '', $folder->getFilename());
|
||||
$uploadField->setFolderName($path);
|
||||
} else {
|
||||
$uploadField->setFolderName('/'); // root of the assets
|
||||
|
Loading…
Reference in New Issue
Block a user