[eluser]TheFuzzy0ne[/eluser]
Right. I'm taking a little break, so I thought I'd spend some time making some suggestions for you. I'm having a look at your code, and I'm so lost. I honestly don't know where to start.
Your validation is all over the place, and needs to be done all at once. Validating the file easy easy enough, you just need to add a hidden input to your form to represent the file upload, and your validation functions will run on the file. I believe I posted an example in a previous post in this thread. If you can tighten up the validation so it all runs in one go like it's supposed to, I think you'll find the reast of your code clearer, and easier to edit.
There are two functions that are in your model which would be better off as private methods in your controller - _is_audio() and _capture_audio(). They have nothing to do with your data storage, and so have nothing to do with models.
There's an awful lot of of validation hackery going on in there too. You shouldn't ever need to call on private methods or set any private properties.
You are accessing $_POST and $_SERVER directly, when you shouldn't need to.
You are doing
Code:
return redirect('');
when redirect doesn't need to be returned. Also, I'm not entirely sure of the reasons you're redirecting back to the index page, if you need to do that, perhaps it would be wise to set a flashdata message that will be picked up by your index page, although this can all be fixed with validation. If the page doesn't validate, show the user errors to tell them what's going on. It will also make your code easier to debug. redirect should be used sparingly, and mainly for redirecting after forms have been submitted. It shouldn't really be used as a bailing out mechanism, your code should handle that.
I don't understand why the user ID needs to be in the URL when it's stored in the userdata. Perhaps I'm missing something?
I'm sorry that most of my advice seems to be criticism, but I honestly believe that if you can work on the points I've mentioned, everything else should fall into place. If you can get your code easier to follow, I might be able to make time tomorrow to help with a rewrite if you'd like, but at the moment, it's needlessly complex and hard to follow.
All the best.