class.upload with code Igniter? How to do?

See all posts See thread Reply

Re: class.upload with code Igniter? How to do? new!
by jonatan fróes, 16 years, 7 months ago
Instead extend, I create a new library

In class.upload we do that:
$foo = new  Upload($_FILES['form_field']);  

But in CI, we load the class this way:
$this->load->library('someclass');
It seems not be able to do
$foo = $this->load->library('someclass');
or
$foo = $this->load->library('someclass', $_FILES['form_field']);

I dont know where I put the $_FILES['form_field']...

my english is poor and I dont know if you will understand me...Reply
Re: class.upload with code Igniter? How to do? new!
by colin, 16 years, 7 months ago
I think you will have to create a wrapper class for the upload class. You would use it like this:

$foo = $this->load->library('someclass');
$this->someclass->init($_FILES['form_field']);
$this->someclass->image_resize(true);
etc.... It is one way to do it, but you can pass all the parameters in a different fashion.

Your library will then wrap the class.upload, and within the library, you will instantiate the upload class, set the parameters, etc...

I don't have the time to try, but that gives you an idea.Reply