Files
sibedas/resources/laravel-code-generator/templates/default/controller-upload-method.stub
Firman Herdiansyah 99e99fa2e6 Update Dashboard Layout
2025-02-05 13:36:33 +07:00

20 lines
590 B
Plaintext

/**
* Moves the attached file to the server.
*
* @param \Symfony\Component\HttpFoundation\File\UploadedFile $file
*
* @return string
*/
protected function moveFile($file)
{
if (!$file->isValid()) {
return '';
}
$fileName = sprintf('%s.%s', uniqid(), $file->getClientOriginalExtension());
$destinationPath = config('laravel-code-generator.files_upload_path','uploads');
$path = $file->move($destinationPath, $fileName);
return $destinationPath . '/' . $fileName;
}