• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MY_ classed and extending native libraries


Because I'm having some issues with the Codeigniter upload class, I wanted to overwrite its is_allowed_filetype() function, I created a file called My_upload under application/libraries. But seems like it doesn't load properly, actually its not loading at all. I'm trying to extend the CI_Upload class, but for a test I created an empty class and echod something in __construct. At last I was able to load my class using auto load, I added my library name to autoload. So after I got it to load, I added my original code which extends the CI_Upload class. Now when I load my site, it says. Fatal error: Class 'CI_Upload' not found in......

I read the user guide and did as it say, but didn't work properly. Is there something that I have missed?


Can you upload your MY_Upload class so we can take a look? Also, I assume it is in the application/libraries directory?

Yes its in application/libraries

I got it to work in my CI installation by capitalizing the "U" in filename. The filename should be "MY_Upload.php".

Hmm yea, but it doesn't overwrite the function is_allowed_filetype(). Sad

[eluser]Phil Sturgeon[/eluser]
MY_upload != MY_Upload

Unless you're on Windows, in which case MY_upload == MY_Upload... Wink

Thanks for the replies, the question I'm having right now is why does the sub class doesn't override the function 'is_allowed_filetype' in parent class :|

I honestly don't know a ton about PHP's internal workings, but just off hand I notice the scope is not explicitly declared in your derived class, whereas the base class has the scope of is_allowed_filetype declared as "public". Does making your is_allowed_type method public make a difference?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.