    protected function putFileInStorage(UploadedFile $uploadedFile)
    {
        $attachmentData = file_get_contents($uploadedFile->getRealPath());

        $storage = $this->getStorage();
        $basePath = 'uploads/files/' . date('Y-m-M') . '/';

        $uploadFileName = Str::random(16) . '.' . $uploadedFile->getClientOriginalExtension();
        while ($storage->exists($basePath . $uploadFileName)) {
            $uploadFileName = Str::random(3) . $uploadFileName;
        }

        $attachmentPath = $basePath . $uploadFileName;

        try {
            $storage->put($attachmentPath, $attachmentData);
        } catch (Exception $e) {
            Log::error('Error when attempting file upload:' . $e->getMessage());

            throw new FileUploadException(trans('errors.path_not_writable', ['filePath' => $attachmentPath]));
        }

        return $attachmentPath;
    }
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.