Maybe you guys can help me out. I’m trying to extend CUploadedFile, but this is not possible. Because CUploadedFile returns itself, and not the class that overrides (in my case the saveAs function) the functions.
The reason i want to override this function is because i want to do some validation before uploading the file. And not validate in the controller where the class is called from.
Of course i’ve searched on the internet for possible solutions, but none were given. Perhaps you guys can help me.
Thanks for the reply! Only this is not quite what i’m looking for. The reason i want to extend CUploadedFile is because i want to do some validation before the file is uploaded, but after the file is validated by the file validator.
These checks consist of checking if the folder exists and if the file name is already uploaded.
I had exactly the same issue, and my solution, though not as clean as simply extending, was to use a behavior. Almost as good and with a secondary class for the factory method it’s seamless beyond the new method names.
Still can’t post links, but I have an example of the implementation we used in a Github Gist - github . gist .com / 4665697