Upload mp3 only! How to make it do it.

Bud Bell
Bud Bell
Offline
0
How do I edit or make it do mp3 only? It uploads everything! I only want mp3's. Any ideas? This will upload gifs and anything. Need help to fix this.
Responses (12)
  • Accepted Answer

    Tuesday, March 13 2012, 11:07 AM - #Permalink
    0
    what you mean? you want to block all uploads from users that are not mp3? is that it?
    The reply is currently minimized Show
  • Accepted Answer

    Bud Bell
    Bud Bell
    Offline
    Tuesday, March 13 2012, 01:10 PM - #Permalink
    0
    Yes plus the other files like gif, php and any other files they upload thru music collection. Thats a big security risk.
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, March 14 2012, 06:14 PM - #Permalink
    0
    I see what you say. well this is not directly blockable, a little bit of modification on one file's code is needed for that...

    are you able to change a bit of code?
    The reply is currently minimized Show
  • Accepted Answer

    Bud Bell
    Bud Bell
    Offline
    Wednesday, March 14 2012, 06:20 PM - #Permalink
    0
    Yes. Do you have the changes?
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, March 14 2012, 06:25 PM - #Permalink
    0
    yes.
    this should be enough: open file /administrator/components/com_muscol/tables/song.php

    go to line 90

    add this:

    $allowed_ext = array('mp3', 'MP3');
    if(in_array($ext, $allowed_ext){

    and then, at the end of the function, you must close that IF sentence. so you must add

    } return "";

    before the function ends, that is in line 126 I think.

    let me know if you understand and if you succed.

    oh by the way, you can add all the allowed extensions in that array I created.
    The reply is currently minimized Show
  • Accepted Answer

    Bud Bell
    Bud Bell
    Offline
    Wednesday, March 14 2012, 06:33 PM - #Permalink
    0
    Ok updated. } return ""; that is at the very end correct?

    return $filename;
    }

    }

    }

    } return "";
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, March 14 2012, 06:35 PM - #Permalink
    0
    no! a bit earlier:


    return $filename;
    }
    } return "";
    The reply is currently minimized Show
  • Accepted Answer

    Bud Bell
    Bud Bell
    Offline
    Wednesday, March 14 2012, 06:38 PM - #Permalink
    0
    Ok so the end looks like this

    return $filename;
    }
    } return "";
    }

    }
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, March 14 2012, 06:39 PM - #Permalink
    0
    yes indeed
    The reply is currently minimized Show
  • Accepted Answer

    Bud Bell
    Bud Bell
    Offline
    Wednesday, March 14 2012, 06:42 PM - #Permalink
    0
    Just tested and go this error.



    Warning: implode() [function.implode]: Invalid arguments passed in /home/crazypra/public_html/administrator/components/com_muscol/tables/album.php on line 122

    Warning: implode() [function.implode]: Invalid arguments passed in /home/crazypra/public_html/administrator/components/com_muscol/tables/album.php on line 123

    Parse error: syntax error, unexpected '{' in /home/crazypra/public_html/administrator/components/com_muscol/tables/song.php on line 91
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, March 14 2012, 06:47 PM - #Permalink
    0
    sorry there was a ")" missing in the first part:
    it should be this:


    $allowed_ext = array('mp3', 'MP3');
    if(in_array($ext, $allowed_ext)){
    The reply is currently minimized Show
  • Accepted Answer

    Bud Bell
    Bud Bell
    Offline
    Wednesday, March 14 2012, 06:49 PM - #Permalink
    0
    That fixed it!
    The reply is currently minimized Show
Your Reply