zhangy Posted October 19, 2009 Share Posted October 19, 2009 Hello, I was wondering what is the best way to allow a user to upload mp3 files to a mysql database and then allow them to be played back from the database (or ive read something about having it in the url, though i dont quite understand it or know if that's applicable here)? Ive read that its not a good idea to play mp3 files from a database or even store them there because of performance issues due to the potential file sizes. If that is the case then what other alternative is there? Link to comment https://forums.phpfreaks.com/topic/178214-solved-music/ Share on other sites More sharing options...
Adam Posted October 19, 2009 Share Posted October 19, 2009 In the database just store the details about the track and a reference to the file location, as apposed to the actual file data itself. Link to comment https://forums.phpfreaks.com/topic/178214-solved-music/#findComment-939613 Share on other sites More sharing options...
zhangy Posted October 19, 2009 Author Share Posted October 19, 2009 Ok, but where would the file location actually be? Link to comment https://forums.phpfreaks.com/topic/178214-solved-music/#findComment-939618 Share on other sites More sharing options...
Adam Posted October 19, 2009 Share Posted October 19, 2009 On your web server. Probs not the same directory of course, but the same server you store your PHP files. or ive read something about having it in the url, though i dont quite understand it or know if that's applicable here Can you elaborate on this? Link to comment https://forums.phpfreaks.com/topic/178214-solved-music/#findComment-939622 Share on other sites More sharing options...
zhangy Posted October 19, 2009 Author Share Posted October 19, 2009 "Can you elaborate on this?" I was hoping someone could explain it to me. But where on my web server would a user be able to upload a file to? How is that done if not with a database? Link to comment https://forums.phpfreaks.com/topic/178214-solved-music/#findComment-939703 Share on other sites More sharing options...
zhangy Posted October 20, 2009 Author Share Posted October 20, 2009 anyone know where else on server can store mp3? Link to comment https://forums.phpfreaks.com/topic/178214-solved-music/#findComment-940446 Share on other sites More sharing options...
Bricktop Posted October 20, 2009 Share Posted October 20, 2009 Hi zhangy, Anywhere you specify. The user would upload the MP3 file via a form, then you would use PHP to copy the file to you specified location. As well as the copy process, you would also (as MrAdam says) update your database with the required file details - location, name, size, title, etc, etc. It's essentially no different to uploading an image, or any file for that matter. Hope this helps. Link to comment https://forums.phpfreaks.com/topic/178214-solved-music/#findComment-940459 Share on other sites More sharing options...
zhangy Posted October 21, 2009 Author Share Posted October 21, 2009 Hi, to be honest this is my first time trying out file uploading with php, so please forgive my ignorance. Is there a way to create a directory using control panel that can store the mp3s? I really cant grasp this. Is there a MO for this practise, some example that I can follow? Link to comment https://forums.phpfreaks.com/topic/178214-solved-music/#findComment-941146 Share on other sites More sharing options...
Bricktop Posted October 21, 2009 Share Posted October 21, 2009 Hi zhangy, Have a look here http://www.tizag.com/phpT/fileupload.php Hope this helps. Link to comment https://forums.phpfreaks.com/topic/178214-solved-music/#findComment-941148 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.