$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));
Here is what the above code is Doing:
1. It’s getting the path of the file that was uploaded.
2. It’s getting the real path of the file that was uploaded.
3. It’s replacing all the backslashes with forward slashes.
Now, we need to create a new file in the public/uploads directory.