File not uploading using laravel in godaddy hosting.
I shift my website from interserver to godaddy. On godaddy file not uploading. before shifting it was uploading files. My website is created in laravel. PLease let me how can i fix this issue.
See code below:
$avatarPath = $this->uploadFile($request->file('avatar'), '/avatars');
function uploadFile($file, $path = '/uploads', $fileName = null)
{
if($fileName) {
$fileName = time() . '_' . $fileName;
} else {
$fileName = time() . '_' . $file->getClientOriginalName();
}
$file->storeAs($path, $fileName, 'public'); // Save the file to the 'storage/app' directory
$filePath = '/storage'.$path.'/'.$fileName;
return $filePath;
}