CI 1.7 multi file upload. Possible? |
I've been trying to do a multi file upload with codeigniter 1.7. I'm having issues to say the least!
I know its an old version but thats what ive got to work with. Can I loop the $_FILES array and upload each one? It doesnt seem to work. Heres what ive got? Code: $dir_name = $this->input->post('dir'); This code runs but doesnt upload the files?!
I was about to have a play with this (I have not done it yet) - might be helpful.
http://blueimp.github.io/jQuery-File-Upload/ Personally, I hate file uploading as it is so open to abuse or misuse. Best wishes, Paul.
I just wrapped up writing this section in my book, actually. I don't have a 1.7 codebase lying around, but I don't think it changed that much.
The issue is that CI's Upload library doesn't support multiple files with the same name. Additionally, the $_FILES array likely isn't structured like you expect it to be. See the official PHP docs for an example. The simplest solution that I could come up with was to modify the $_FILES array directly to have a unique file name and data in a way that the Upload library can deal with it. The following function will do that for you: Code: public function restructureFilesArray($files) You can then use it in your controller something like: Code: public function index() |
Welcome Guest, Not a member yet? Register Sign In |