Fixes#3332.
FileUpload widget uploads file to the disk specified by default in config/filesystem.php instead of storage.uploads.disk in config/cms.php, if we use System\Models\File following the instruction in here.
Although we can still create another class extending System\Models\File or October\Rain\Database\Attach\File and use it as the model for attachOne/Many relation, System\Models\File seems to be the one that responsible to look at storage.uploads.disk in config/cms.php, because the existing methods are using storage.uploads.*.
Credit to @pikanji
- Not sure how this was not fixed sooner, since there is no easy way to obtain a full qualified URL from a system file.
- If a CDN is used this method will return a URL.
- The asset combiner returns a FQ URL as well, although it didn't always, perhaps this is a relic from that time that was never retrofitted.
The local storage driver is not suitable because it does not apply the appropriate permissions to local files. This is a big issue especially for shared hosting where the webserver will create a file and the owner is locked from touching it. We detect the local driver and use the FileHelper class whenever a file or directory is created. Eg: if configured to apply chmod 777 then it will be fulfilled as expected.
The /uploads directory has been moved to /storage/app/uploads to make way for CDN support. This directory should be moved on the file system and the config (cms.uploadsPath) updated.