public function upload(Request $request, $dirId)
    {

        try {

            $folder = $this->getDirOrFail($dirId);

            if (!$request->hasFile('uploadedFile')) {
                throw new RuntimeException('Uploaded File not found');
            }

            $uploadedFile = $request->file('uploadedFile');

            /** @var UploadedFile $uploadedFile */
            $uploadedFile = is_array($uploadedFile) ? $uploadedFile[0] : $uploadedFile;

            $fileName = $uploadedFile->getClientOriginalName();

            $newPath = $this->getTempDir() . '/' . $fileName;

            $uploadedFile->move($this->getTempDir(), $fileName);

            $this->fileDB->importFile($newPath, $folder);

            return $this->redirectTo('index', $folder->getId());

        } catch(FileException $e) {
            $this->flashMessage('upload-failed','danger');
        } catch(RuntimeException $e) {
            $this->flashMessage('uploaded-file-missing','danger');
        }

        return $this->redirectTo('index');

    }