Skip to content

Commit

Permalink
Add capability to better choosing uploaded file type
Browse files Browse the repository at this point in the history
  • Loading branch information
lanfisis committed Aug 20, 2021
1 parent 6b17d81 commit 4142fa9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/Twig/RichEditorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public function getCurrentFilePath(array $context): ?string
$path = $form->vars['data'];
if (!empty($app->getRequest()->get('rich_editor_uploaded_files'))) {
$uploadedFile = $app->getRequest()->get('rich_editor_uploaded_files');
if (null !== ($fullName = $uploadedFile->getFullName())) {
if (null !== ($fullName = $uploadedFile['full_name'] ?? null)) {
return $fullName;
}
}
Expand Down
22 changes: 3 additions & 19 deletions src/Uploader/FileUploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,10 @@ class FileUploader
public const FILE_TYPE_IMAGE = 'image';
public const FILE_TYPE_VIDEO = 'video';

/**
* @var string
*/
private $fileTargetPath;

/**
* @var string
*/
private $imageTargetPath;
private string $fileTargetPath;
private string $imageTargetPath;
private string $publicDirectory;

/**
* @var string
*/
private $publicDirectory;

/**
* @param string $fileTargetPath
* @param string $imageTargetPath
* @param string $publicDirectory
*/
public function __construct(string $fileTargetPath, string $imageTargetPath, string $publicDirectory)
{
$this->fileTargetPath = $fileTargetPath;
Expand Down

0 comments on commit 4142fa9

Please sign in to comment.