# acymailing/11.1.0/back/Controllers/FileController.php

AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress, version 11.1.0. 66 lines.

- Page: https://pluginprobe.com/plugins/acymailing/11.1.0/code/back/Controllers/FileController.php
- Raw: https://pluginprobe.com/plugins/acymailing/11.1.0/raw/back/Controllers/FileController.php
- Modified: 2026-08-03T10:18:54+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/acymailing/11.1.0/code/back/Controllers/FileController.php#L10-L20`.

```php
<?php

namespace AcyMailing\Controllers;

use AcyMailing\Core\AcymController;
use AcyMailing\Types\FileTreeType;

class FileController extends AcymController
{
    public function __construct()
    {
        parent::__construct();

        $this->setDefaultTask('select');
    }

    public function select(): void
    {
        acym_setVar('layout', 'select');

        $warnings = '';
        $uploadFolderBase = acym_getFilesFolder();
        $currentFolder = acym_getVar('string', 'currentFolder', $uploadFolderBase);
        if (strpos($currentFolder, $uploadFolderBase) !== 0 || strpos($currentFolder, '..') !== false) {
            $currentFolder = $uploadFolderBase;
        }

        $uploadFolder = trim(str_replace('/', DS, trim($currentFolder)), DS);
        $uploadPath = acym_cleanPath(ACYM_ROOT.$uploadFolder);
        $folders = acym_generateArborescence([$uploadFolderBase]);

        $uploadedFile = acym_getVar('array', 'uploadedFile', [], 'files');
        $selectedFile = '';
        if (!empty($uploadedFile['name'])) {
            wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');

            ob_start();
            $uploaded = acym_importFile($uploadedFile, $uploadPath, false);
            $warnings = ob_get_clean();
            if (!empty($uploaded)) {
                $selectedFile = $uploaded;
            }
        }

        $files = [];
        if (file_exists($uploadPath)) {
            $files = acym_getFiles($uploadPath);
        }

        $data = [
            'files' => $files,
            'uploadFolder' => $uploadFolder,
            'map' => acym_getVar('string', 'id'),
            'displayType' => acym_getVar('string', 'displayType', 'icons'),
            'imageExtensions' => acym_getImageFileExtensions(),
            'allowedExtensions' => explode(',', $this->config->get('allowed_files')),
            'folders' => $folders,
            'fileTreeType' => new FileTreeType(),
            'selectedFile' => $selectedFile,
            'warnings' => $warnings,
        ];

        parent::display($data);
    }
}

```
