I was trying to extend the CUploadedFile component to add more saveAs methods and allow to use different storages (like s3) but, because it is using a singleton (CUploadedFile::getInstance()) to instanciate the object, it looks impossible.
Unless I’m doing something wrong here, can we make this component more flexible?
In my project I had to create my own version of this class (in terms to make hierarchy Uploaded File -> Uploaded Video, Uploaded Image etc), where i created instance i got current class in following way:
And i found it’s useful to create beforeSave and afterSave methods.
Also I made wrappers for move_uploaded_file and is_uploaded_file cause I needed to mock them for functional tests.
Actually it would be good to make it possible to have multiple uploader classes that can be changed in config to upload to local server filesystem or Amazon S3 or whatever.