20 lines
590 B
Plaintext
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;
|
|
} |