indrayusri
4 days ago

error uploading photo

Posted 4 days ago by indrayusri

I'm using this code to upload photo

protected function savePhoto(UploadedFile $photo) { $fileName = str_random(40) . '.' . $photo->guessClientExtension(); $destinationPath = public_path() . DIRECTORY_SEPARATOR. 'img'; $photo->move($destinationPath, $fileName);

    return $fileName;
}

but the output is

Symfony\Component\Debug\Exception\FatalThrowableError Call to undefined function App\Http\Controllers\str_random()

Please sign in or create an account to participate in this conversation.