I'm trying to check if file exists using storage exists()
function.
This function returns true
if file name doesn't have spaces
but false
otherwise.
I'm trying to use Storage facades code as follows
if (Storage::disk("local")->exists($model->path)) { // path of the file
Storage::move(); // logic to move files
}
Storage folders has all permissions
I have lot of files with spaces
in my storage subfolder F1
. I want to move those file to another subfolder F2
inside storage itself. It would be tedious to rename each and every file for exists()
to work.
Update
Php inbuilt file_exists()
works for same path i.e it returns true
if file is found and even if it has spaces
in it's name.
Code for file_exists()
file_exists(storage_path() . '/app/F1/Demo One.pdf');
I have used tinker for debugging.
Why storage facades exists()
returns false
?