views:

21

answers:

2

Is it possible to write an upload script in php that takes the file information(for example... a music file has the artist, album ect ect within the file information) and writes it into a database? If so how would i go abouts doing so...

+1  A: 

If you are specifically talking about about ID3, there is a PECL extension for reading from files. You would need to upload the file, then process the file through the plugin, however, you would need access to your PHP installation to use it, so you may not be able to do this in a shared hosting environment.

Edit: as an alternative you might check out http://getid3.sourceforge.net/ I have never personally used it but it doesn't look like it depends on the PECL extension mentioned above, and uses PHP to parse through the file.

cmendoza
A: 

If you literally want artist/album/title information from an MP3 file, you need to read its ID3 tag. PECL provides id3_get_tag for this:

$info = id3_get_tag($filename);
// use e.g. $info['title']; to get the title
Michael Mrozek