class ActionQuickUpload in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2
Hierarchy
- class \Drupal\n1ed\Flmngr\FileUploaderServer\lib\action\AAction
- class \Drupal\n1ed\Flmngr\FileUploaderServer\lib\action\AActionUploadId
- class \Drupal\n1ed\Flmngr\FileUploaderServer\lib\action\ActionQuickUpload
- class \Drupal\n1ed\Flmngr\FileUploaderServer\lib\action\AActionUploadId
Expanded class hierarchy of ActionQuickUpload
1 file declares its use of ActionQuickUpload
- Actions.php in src/
Flmngr/ FileUploaderServer/ lib/ Actions.php
File
- src/
Flmngr/ FileUploaderServer/ lib/ action/ ActionQuickUpload.php, line 18
Namespace
Drupal\n1ed\Flmngr\FileUploaderServer\lib\actionView source
class ActionQuickUpload extends AActionUploadId {
public function getName() {
return 'upload';
}
public function run($req) {
$fileSystem = new FMDiskFileSystem([
'dirFiles' => $this->config
->getBaseDir(),
'dirCache' => '',
]);
if ($req->file) {
if (array_key_exists('dir', $_POST) && $_POST['dir'] && $_POST['dir'] != '/' && $_POST['dir'] != '' && $_POST['dir'] != '.') {
$target_dir = basename($_POST['dir']);
$path = dirname($_POST['dir']) == '.' || dirname($_POST['dir']) == '/' ? '' : '/' . dirname($_POST['dir']);
$fullPath = basename($this->m_config
->getBaseDir()) . $path;
$fileSystem
->createDir($fullPath, $target_dir);
$uploadDir = $fileSystem
->getAbsolutePath($fullPath) . '/' . $target_dir;
$req->m_relativePath = $_POST['dir'];
}
else {
$target_dir = '';
$fullPath = basename($this->config
->getBaseDir());
$uploadDir = $fileSystem
->getAbsolutePath($fullPath) . '/' . $target_dir . '/';
$req->relativePath = '/';
}
$file = new FileUploadedQuick($this->config, $uploadDir, $req->fileName, $req->fileName, $req->relativePath);
$file
->upload($req->file);
$resp = new RespUploadAddFile();
$resp->file = $file
->getData();
return $resp;
}
else {
throw new MessageException(Message::createMessage(Message::FILES_NOT_SET));
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AAction:: |
protected | property | ||
AAction:: |
public | function | Sets a config. | |
AAction:: |
protected | function | Validates boolean and returns default value if null. | |
AAction:: |
protected | function | Validates integer and returns default value if null. | |
AAction:: |
protected | function | Validates string and returns default value if null. | |
AActionUploadId:: |
protected | function | Validates upload ID and throws exception in case of validation error. | |
ActionQuickUpload:: |
public | function |
Returnes name of action. Overrides AAction:: |
|
ActionQuickUpload:: |
public | function |
Runs action. Overrides AAction:: |