grantus
Active member
I'm trying to get an upload form to work but encountering some issues. First of all, here's my code so far in my Controller:
I have everything set up properly with routing.
When I submit the form, it moves my mp3 file to the proper directory but then I get this error message:
Does anyone know what the issue is?
Thanks.
Code:
public function actionUpload(ParameterBag $params)
{
$dataDir = \XF::app()->config('externalDataPath');
$upload = $this->request->getFile('upload', false, false);
$originalFileName = '';
if ($upload && strtolower($upload->getExtension()) === 'mp3')
{
$originalFileName = $upload->getFileName();
$targetDirectory = $dataDir . '://upload_test/';
$dataDir = $targetDirectory . $originalFileName;
\XF\Util\File::copyFileToAbstractedPath($upload->getTempFile(), $dataDir);
return true;
}
$viewParams = [
'upload' => $upload,
'dataDir' => $dataDir
];
return $this->view('Testing\Test:Upload', 'upload_test', $viewParams);
}
I have everything set up properly with routing.
When I submit the form, it moves my mp3 file to the proper directory but then I get this error message:
Code:
TypeError: XF\Mvc\Controller::postDispatch(): Argument #3 ($reply) must be of type XF\Mvc\Reply\AbstractReply, bool given
Does anyone know what the issue is?
Thanks.