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

[eluser]TheFuzzy0ne[/eluser]
The error you're getting is "You have not specified any allowed file types."

You add something like:
Code:
$config['allowed_types'] = 'mp3';

to the config array you're passing to the upload class constructor. I don't believe this will cover formats such as ogg, or WMA, but we'll have to see.

EDIT: I noticed that you actually have this in your code. Hmmm... Strange... Are you sure you've not loaded the upload class elsewhere?
#12

[eluser]TheFuzzy0ne[/eluser]
Please repost your code. Hopefully you've now learnt that developing on a live site is a bad idea. Tongue
#13

[eluser]TheFuzzy0ne[/eluser]
Just to be sure. Load the upload class, and then use the initialize method to parse the config array.
#14

[eluser]TheFuzzy0ne[/eluser]
Another thought that just occurred to me... You're problem could have something to do with the max file size set in the php ini. You need to ensure it's set to match (or slightly above) what you set for the upload library.
#15

[eluser]markanderson993[/eluser]
[quote author="TheFuzzy0ne" date="1236328891"]I think this line doesn't do your code any justice:
Code:
$this->validation->error_string .= $this->validation->_error_prefix.'The audio selection cannot be any longer than 20 minutes.'.$this->validation->_error_suffix;

It's been added after the validation has run, and it's a bit hacky. This test should be a validation callback. Simply add a method to your controller that passes the data to the model, and returns TRUE or false depending on the outcome.[/quote]

Hey Fuzzy, I'm a bit confused by this. Can you show an example of what you mean?
#16

[eluser]TheFuzzy0ne[/eluser]
Code:
function _valid_filesize()
{
    if (!$this->audio_model->is_audio($_FILES['userfile']['tmp_name'],'size'))
    {
        $this->form_validation->set_message('_valid_filesize', 'The audio selection cannot be any longer than 20 minutes.');
        return FALSE;
    }
    return TRUE;
}

Something like the above (although it could still use some tweaking).

Then add it to your rules.
Code:
$rules = array(
        'field' => 'audio_file',
        'label' => 'Audio File',
        'rules' => 'callback__valid_filesize'
    );
$this->form_validaton->set_rules($rules);

In order for this to work, you'll probably have to add a hidden form field called "audio_file".

EDIT: In fact, I see two validation attempts that need to be done as callbacks. This will ensure the the validation is all done at once.
#17

[eluser]markanderson993[/eluser]
I do believe you might be on to something there. I had max_size in my controller 20 megabytes over the limit in my php.ini file, :/ I'm going to have the minions test it.
#18

[eluser]TheFuzzy0ne[/eluser]
Right. I have to go to bed. It's 4AM and I feel creamed. Good luck with your controller. If you still don't have it sorted tomorrow, I'll happily try and do a rewrite with you. I would have done so tonight, but it's a real pain in the ass working with the tiny screen on my laptop...

G'nite!
#19

[eluser]markanderson993[/eluser]
I completely understand how you feel. Get some rest and I'll see ya on the other side. You've been extremely helpful so far and I really appreciate it. Smile

Thank you!
#20

[eluser]TheFuzzy0ne[/eluser]
How did you get on with your controller? Any progress? Can I see your code so far?




Theme © iAndrew 2016 - Forum software by © MyBB