How can i manually create a SplFileInfo similar to the FileUpload object?
Hi,
I have a function that stores an uploaded file, creates a DB record and moves it somewhere on the disk. This works fine.
Now I also have to store other files that already exists on the disk with the same method. I was hoping i could just create a SplFileInfo object from this file, and pass it on to my "save" function:
use SplFileInfo;
...
$file = new SplFileInfo($orgFilePath);
However, this object behaves differently from the FileUpload object. Instead of
$ext = $file->extension();
i have to use the methods as described in in the PHP docs:
$ext = $file->getExtension();
and it does not have Laravels $file->storeAs() method.
How can i manually create a "Laravel" SplFileInfo object from an existing path, that has the same properties as the FileUpload object? Everything i find on Google is just 20 different tutorials about uploading a file, but nothing about basic file operations ...
Please or to participate in this conversation.