mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
API: custom upload folder
Possibility to set a custom upload folder through Component $config
This commit is contained in:
parent
1e260d2b48
commit
65d1e7c5cb
@ -18,7 +18,8 @@ class GridFieldBulkImageUpload implements GridField_HTMLProvider, GridField_URLH
|
|||||||
'imageFieldName' => null,
|
'imageFieldName' => null,
|
||||||
'editableFields' => null,
|
'editableFields' => null,
|
||||||
'fieldsClassBlacklist' => array( 'GridField', 'UploadField' ),
|
'fieldsClassBlacklist' => array( 'GridField', 'UploadField' ),
|
||||||
'fieldsNameBlacklist' => array()
|
'fieldsNameBlacklist' => array(),
|
||||||
|
'folderName' => 'bulkUpload'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -235,7 +235,7 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
|
|||||||
|
|
||||||
$uploadField->setConfig('url', $this->Link('upload'));
|
$uploadField->setConfig('url', $this->Link('upload'));
|
||||||
|
|
||||||
$uploadField->setFolderName(ASSETS_DIR);
|
//$uploadField->setFolderName(ASSETS_DIR);
|
||||||
|
|
||||||
|
|
||||||
$form = new Form(
|
$form = new Form(
|
||||||
@ -314,7 +314,7 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
|
|||||||
|
|
||||||
// Get the uploaded file into a new file object.
|
// Get the uploaded file into a new file object.
|
||||||
try {
|
try {
|
||||||
$upload->loadIntoFile($tmpfile, $fileObject, 'Uploads/bulk');
|
$upload->loadIntoFile($tmpfile, $fileObject, $this->component->getConfig('folderName'));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// we shouldn't get an error here, but just in case
|
// we shouldn't get an error here, but just in case
|
||||||
$return['error'] = $e->getMessage();
|
$return['error'] = $e->getMessage();
|
||||||
|
Loading…
Reference in New Issue
Block a user