Problem uploading multiple files from the input file field with same name |
[eluser]Unknown[/eluser]
Hello! I am just a beginner in codeigniter, and also not very experienced in PHP either. I just like to play with something to learn and CI really gives a lot of opportunities for learners like me! I just faced a problem uploading multiple files from the input file field with same name. My html forms has some fields like this . Code: <input type="text" name="question[]" value="b" /> an array of explanationvids. Array is required as there are no fixed number of files. User click a button "add section" to dynamically generate the input field. Now i can work with Code: $this->input->post('question', TRUE); but how do i upload the files in the field named explanationvid[] i am trying to do something like this- Code: for ($sidx = 0; $sidx < sizeof($lessonVidData['explanationvid']); $sidx++) { but it doesnt work, i know it shouldnt as i believe do_upload() expects name of a single field not an array. Please tell me how i can tell do_upload() something like - Code: $this->upload->do_upload('explanationvid['.$sidx.']') Code: $this->upload->do_upload('explanationvid[0]') i prefer this 1 by 1 upload as i also need to do some database insertion for each upload
[eluser]dnc[/eluser]
Please check this post : Multiple File Upload and keep us up to to date on your progess!
[eluser]Unknown[/eluser]
[quote author="dnc" date="1339047424"]Please check this post : Multiple File Upload and keep us up to to date on your progess![/quote] Thanks for the fast reply! Unfortunately the extension is for situations like this- Code: <input type="file" name="file_1" size="20" /> Code: <input type="file" name="file[]" size="20" /> and its actually doing a mass upload. I want to upload files 1 by 1. Please refer to the original post for more details. All I need to know how i can pass a single element of the array file[] to $this->upload->do_upload(); Thanks again, I appreciate your interest! |
Welcome Guest, Not a member yet? Register Sign In |