Welcome Guest, Not a member yet? Register   Sign In
Audio uploader only working on SOME computers
#21

[eluser]markanderson993[/eluser]
Holy cow and I thought I woke up fast! To be honest I haven't gotten any work in yet since I've been sleeping :/ After that, school awaits so I will begin working on the Controller around 3PM Central Time which is a long ways away from right now.

If you have any time between now and then you can get a jumstart on that controller, otherwise I'd be fine with working on it in 7 hours or so.

- Pianoman993
#22

[eluser]TheFuzzy0ne[/eluser]
It would help if you can post the code you have so far.
#23

[eluser]pistolPete[/eluser]
What's the setting of post_max_size in your php.ini?
#24

[eluser]markanderson993[/eluser]
I believe it is 30 MB. Fuzzy, my code is virtually the same as it was in the first post.
#25

[eluser]TheFuzzy0ne[/eluser]
There is code missing, so I can't do a rewrite. Also, I've spent my whole day getting ass-whipped by an htaccess file, and so haven't done any work so I'm behind. However, for your file validation, I would suggest you extend the Upload class, and have it check the length of the media.
#26

[eluser]markanderson993[/eluser]
Alright no problem. I'll PM you the controller and model in their entirety. Smile
#27

[eluser]TheFuzzy0ne[/eluser]
Sorry. You must have missed the part where I said I was behind on my work. Sorry, I'm taking the night off as I have to catch up. I might be on later, however. Perhaps in about 5 hours?
#28

[eluser]markanderson993[/eluser]
Whatever works for you. Good luck on your .htaccess problem, they drive me through the roof!
#29

[eluser]markanderson993[/eluser]
Just as a note for you when you begin looking at the Controller, members are all receiving the
Quote:You have uploaded a file of an incorrect filetype
error. Hopefully this helps you Smile
#30

[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.




Theme © iAndrew 2016 - Forum software by © MyBB