Strange behavior on file type

Hello,

I'm running an elgg powered site for a community of online jamming people (basically people are connecting to jamming servers, playing music alltogether in almost live, and so on), and for sharing music done, users can upload files directly using the file plugin.

To playback file, I'm using zaudio plugin, but apparently, and I still didn't find why yet, certain mp3 files are recognised as such, and zaudio loads, while some others are not.

In the file list, they appear blank, as general files.

It's not dependant on file size, and it does seems related to encoding rate and quality?

Would some of you have some ideas?

 

  • It's likely to be to do with browser differences in the users uploading files. One of the updates we had to make for 1.5 involved Internet Explorer returning a completely different MIME-type for JPEGs; it's possible that the same thing is happening for MP3s.

    PHP 5.3 contains a new set of functions that will detect filetype from the saved bits (as opposed to what the uploading browser tells it), but they're too new to rely on yet.

  • Omg thx for the info and direction Ben, was looking and thinking about this from a server side perspective, didn't think from client side. :)

    Again, huge felicitations for all the work you all made on elgg, it's amazing and wonderful :)

  • For the record, and for the information, found a fix about the problem.

    This problem could affect any plugin using file upload, and is related to php mime magic function.

    Mime magic support is broken inside some debian/ubuntu versions, maybe on some other systems, you have to check your phpinfo().

    You should have inside a

    mime_magic support        enabled

    If you have it disabled, you have the 'bug'. To fix it, here's the sumup :

    On Debian/Ubuntu system, You'll have to modify your php.ini (located /etc/php5/apachex) and add the following section in the end of it.

    [mime_magic]
    mime_magic.magicfile = "/usr/share/file/magic.mime"

    Depending of your version too, the mime file may 'not be ok' too, so you'll have to turn on startup error logging in php config file, restart your web server and check the problems eventually appearing regarding mime magic (and fix the wrong lines).

    Hope this will help!!