API: custom upload folder

Possibility to set a custom upload folder through Component $config
This commit is contained in:
colymba 2012-08-07 22:40:12 +03:00
parent 1e260d2b48
commit 65d1e7c5cb
2 changed files with 4 additions and 3 deletions

View File

@ -18,7 +18,8 @@ class GridFieldBulkImageUpload implements GridField_HTMLProvider, GridField_URLH
'imageFieldName' => null,
'editableFields' => null,
'fieldsClassBlacklist' => array( 'GridField', 'UploadField' ),
'fieldsNameBlacklist' => array()
'fieldsNameBlacklist' => array(),
'folderName' => 'bulkUpload'
);
/**

View File

@ -235,7 +235,7 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
$uploadField->setConfig('url', $this->Link('upload'));
$uploadField->setFolderName(ASSETS_DIR);
//$uploadField->setFolderName(ASSETS_DIR);
$form = new Form(
@ -314,7 +314,7 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
// Get the uploaded file into a new file object.
try {
$upload->loadIntoFile($tmpfile, $fileObject, 'Uploads/bulk');
$upload->loadIntoFile($tmpfile, $fileObject, $this->component->getConfig('folderName'));
} catch (Exception $e) {
// we shouldn't get an error here, but just in case
$return['error'] = $e->getMessage();