Jump to content

Recommended Posts

I'm not quite sure if this would fall into PHP or MySQL help, but here goes.

 

When dealing with uploaded .mp3 files what is the best solution to storing them? Should I use a DB, specified directory, is there a way to archive and compress before storage without affecting quality.

 

I just want to know everything I can before I begin working on my project. If you have any articles, personal experience dealing with this type of thing, etc..

 

Thanks again.

Link to comment
https://forums.phpfreaks.com/topic/114584-dealing-with-mp3-files/
Share on other sites

i would store the code needed to embed them or whatever your application is in mysql and store them in a folder in you site, this question comes up a lot about images, and the response always seems to be, store them in a folder, it cuts down on db bloat, removes the possibility of getting a truncated file because it has exceeded your blob size, makes querys faster... the list goes on

Thanks lodius.  ;)

 

It's one of the things that is starting to really bother me, eventually I'm going to run out of server space even if I limited the upload size to 5MB, and in-terms of .mp3 quality is attrocious.

 

More opinions, ideas, corrections to my previous beliefs :D...?

Ok I've done a little bit of reading while waiting for responses and I've come to a semi-conclusion.

 

The solution would be to read the mp3 binary and store it in a longtext, longblob, or blob row in a database, with two tables for info.

1. blob_id, blob_data, blob_timestamp, more (depending), etc..

2. .mp3 info ( artist, blob_id, file_size, timestamp, etc...)

 

Then I would retrieve the data from the database, etc.. and route them to a flash player.

 

Wallah!? Opinions on this solution, or is it a dud.

 

This is my first time dealing with .mp3 so go easy on me if it's an absurd solution.

"eventually I'm going to run out of server space"

 

is your db space independent of your server space, if so then definately store the mp3s in the place with more space, but a 5mb mp3 takes up just as much space in a db as it does as a phisical file. BUT

 

i am going to swich from BLOB to TEXT because i know more about it

 

a TEXT field takes up 80 kb no matter what the size of the data entered in it contains. 120kb of text stored in a TEXT field will truncate after 80kb, 80kb of text will store all of the text, 1kb of text will store 1kb of text and 79 kb of NULL data, so regardless of the data size to be stored, 80 kb will be stored, so if the same is true for blob, which i think it is, your max blob size will be used for every stored mp3, soooooo a 3 megger will take up the same as a 1 megger so if your db is infinite storage and your server is not, use the db, if your server space and db are linked (which i bet they are) the db method will kill your server space faster because it is using the max filespace fore every upload

 

anyone, If i am wrong call me on it

 

thanks

"eventually I'm going to run out of server space"

 

is your db space independent of your server space, if so then definately store the mp3s in the place with more space, but a 5mb mp3 takes up just as much space in a db as it does as a phisical file. BUT

 

i am going to swich from BLOB to TEXT because i know more about it

 

a TEXT field takes up 80 kb no matter what the size of the data entered in it contains. 120kb of text stored in a TEXT field will truncate after 80kb, 80kb of text will store all of the text, 1kb of text will store 1kb of text and 79 kb of NULL data, so regardless of the data size to be stored, 80 kb will be stored, so if the same is true for blob, which i think it is, your max blob size will be used for every stored mp3, soooooo a 3 megger will take up the same as a 1 megger so if your db is infinite storage and your server is not, use the db, if your server space and db are linked (which i bet they are) the db method will kill your server space faster because it is using the max filespace fore every upload

 

anyone, If i am wrong call me on it

 

thanks

No. To put it very simply, blob is a giant varchar.

More opinions?

 

The more perspectives/ideas, the better.

 

Sorry for being so persistent about this, I'm trying to discover  solution as quickly as possible so I can begin working. Unfortunately I can't find any real proof, ie. a properly designed audio website's developer's opinion on this subject.

I've gone up and down google, and I'm very disappointed to report that I can't find any solid information as to how this can be done effeciently.

 

Newgrounds.com has a nice little set-up similar to what I'd like to do so I'm PMed a few admin there who might be able to help me out, but I've found a few other things as well.

 

A consensus was made amoung a few of the articles I read, and that is:

Not to store the actual .mp3 in the mySQL DB, but rather, store the .mp3 somewhere else on your server, and just store the path in the database. And then call it.

 

Well, where else on the server are they suggesting I save it?

 

Any opinions at all, this is driving me crazy.

 

 

 

One more solution:

 

store the files themselves in your fs, then create the logic with the db, for example I would have the path, filename and tag info in a db and the files on the fs, then I could use the db for logic with the interface...

 

*shrug*

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.