![]() |
FancyUpload and CI - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: FancyUpload and CI (/showthread.php?tid=9559) |
FancyUpload and CI - El Forum - 06-30-2008 [eluser]Martin Snajdr[/eluser] Is there anybody who is successfully using FancyUpload with CI? I'm trying to get it work but there was a problem with $this->upload->do_upload and $this->upload->data. So I created MY_upload class with two functions like these above. I combined original do_upload with the script.php which is using in Fancyupload Demo. Almost everything is ok - I can upload multiple files but when I want to get upload data out of this, i get only empty array.... If anyone interested in it, i can post my code... Thanks FancyUpload and CI - El Forum - 06-30-2008 [eluser]Yash[/eluser] ya sure ![]() I want to look that.. FancyUpload and CI - El Forum - 08-10-2010 [eluser]Unknown[/eluser] I know this is old post but google found almost nothing useful about handling CI uploads with FancyUpload. I believe it's still a problem for a lot of people. I came up with this solution: In config/mimes.php we add 'application/octet-stream' to all mimes we want to use FancyUpload to upload. Code: . In our controller we utilize regular way of dealing with uploads: Code: . Now we just add another check (getimagesize()) to our if..else: Code: . We're using suppressor operator (@) with getimagesize function so it doesn't generate PHP errors in case of failure (uploaded file isn't image). In case uploaded file isn't image we load file helper and replace file_type value with file helper function get_mime_by_extension(). This is it, I hope anyone finds this helpful. EDIT: I got an email asking me to explain a bit more how to integrate FancyUpload into CI forms. I'm not going through generic FancyUpload integration (you can find that out at Harald's page: http://digitarald.de/project/fancyupload/3-0/showcase/photoqueue/). That said, let's begin! We have our form (no kiddin' ;-)) and this form has it's action e.g. form/upload. Now we have to write a method for receiving FancyUpload uploads only. Let's call it fancyUpload(). Since FancyUpload sends data with 'Filedata name (not sure but i think this can be changed) we have to tell our do_upload() method to look for it. Our controller should now look something like this: Code: . SInce FancyUpload degrades gracefully to Code: <input type="file" name="Filedata" /> Code: . There is one more important thing to do now. FancyUpload takes form's action as his upload url - we have to change this cause we want to process only file uploads. We do this in javascript where we create FancyUpload instance: Code: . Now if everything is done correctly we should have a working FancyUpload uploader in our CI form :-) |