HTML5 Multiple File Upload |
[eluser]RMinor[/eluser]
I am trying to upload multiple files using a single HTML5 file input field. When I try to upload I get the following error " Illegal offset type in isset or empty" and "You did not select a file to upload." How would I go about fixing this issue? Thanks! CONTROLLER Code: /** VIEW Code: <form name="form" id="contact-form" method="post" acti enctype="multipart/form-data">
[eluser]TheFuzzy0ne[/eluser]
By default, CodeIgniter expects your file field to be called "userfile", or that you pass the field name of the file to the do_upload() method. You are passing an array. I'm not sure that the upload library supports an array of uploaded files. You might have to extend the library and add support for that yourself, but I'm not certain.
[eluser]RMinor[/eluser]
I think this thread, http://stackoverflow.com/questions/99036...es-at-once, might be the answer I need. I will give it a go in a couple hours and post my finished working code.
[eluser]RMinor[/eluser]
Here is my working code. It uploads any number of photos, re-sizes them, and crops a 200x200 thumbnail. It also displays each successful upload and if needed any failed uploads along with their respective errors. Hopefully this can help someone else out as well. I omitted the model, but it's pretty self-explanatory. CONTROLLER (Will be in two pieces due to character limit) Code: /**
[eluser]RMinor[/eluser]
...continued CONTROLLER Code: /** View to come in next post...
[eluser]RMinor[/eluser]
...continued, here is the view VIEW Code: <!DOCTYPE html>
[eluser]TheFuzzy0ne[/eluser]
Wow, that's a lot of code! But well done, and thanks for posting back your solution.
[eluser]RMinor[/eluser]
No problem at all and you're welcome. I know it's a lot of code. I intend to move most of it into the model and call it from the controller. |
Welcome Guest, Not a member yet? Register Sign In |