Hi, I am trying to store mp3 files using the attachment_fu and I have managed to store it on the file system and the database as a blob. The problem is I dont know if saving it in the public folder of the file system is safe and when I store it as an longblob in the database how do i send it back to the user as something that can be downloaded. I apologize if this sounds too silly as I am a newbie and trying to build an app which handles large amounts of mp3 files. I am also worried about security of storing the music files on the public folder. I would appreciate any help on this . Thank you -- Posted via http://www.ruby-forum.com/.
You probably do not want to store the files in public. Store them somewhere else if you need to protect them with passwords. You can easily upload them to Amazon''s S3 with attachment_fu, just be sure to set :s3_access to an appropriate value And you can use send_data with :disposition => ''inline'' to send the data to the user. See http://api.rubyonrails.org/classes/ActionController/Streaming.html On Aug 12, 10:57 am, Siddharth Ravichandran <rails-mailing- l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > > I am trying to store mp3 files using theattachment_fuand I have > managed to store it on the file system and the database as a blob. The > problem is I dont know if saving it in the public folder of the file > system is safe and when I store it as an longblob in the database how do > i send it back to the user as something that can be downloaded. > > I apologize if this sounds too silly as I am a newbie and trying to > build an app which handles large amounts of mp3 files. I am also worried > about security of storing the music files on the public folder. > > I would appreciate any help on this . > > Thank you > -- > Posted viahttp://www.ruby-forum.com/.
hitch wrote:> You probably do not want to store the files in public. Store them > somewhere else if you need to protect them with passwords. > You can easily upload them to Amazon''s S3 with attachment_fu, just be > sure to set :s3_access to an appropriate value > And you can use send_data with :disposition => ''inline'' to send the > data to the user. See > http://api.rubyonrails.org/classes/ActionController/Streaming.html > > On Aug 12, 10:57�am, Siddharth Ravichandran <rails-mailing-Thank you for the response. I read on a few forums that storing it on the public file is better because it reduces databases access time which may eventually slow done the entire application. As I would be working with a lot of mp3 files is there anyway I can store them in folder that can be protected because Mysql does not handle the blob format very well and I am unable to get it retrieve it with the same quality. Can mp3s be stored in mysql in any other way like binary format and retrieved without loss of quality. Thank you again. -- Posted via http://www.ruby-forum.com/.
On Aug 13, 3:06 pm, Siddharth Ravichandran <rails-mailing-l...@andreas- s.net> wrote:> hitch wrote: > > You probably do not want to store the files in public. Store them > > somewhere else if you need to protect them with passwords. > > You can easily upload them to Amazon''s S3 with attachment_fu, just be > > sure to set :s3_access to an appropriate value > > And you can use send_data with :disposition => ''inline'' to send the > > data to the user. See > >http://api.rubyonrails.org/classes/ActionController/Streaming.html > > > On Aug 12, 10:57 am, Siddharth Ravichandran <rails-mailing- > > Thank you for the response. I read on a few forums that storing it on > the public file is better because it reduces databases access time which > may eventually slow done the entire application. As I would be working > with a lot of mp3 files is there anyway I can store them in folder that > can be protected because Mysql does not handle the blob format very well > and I am unable to get it retrieve it with the same quality. > > Can mp3s be stored in mysql in any other way like binary format and > retrieved without loss of quality. > > Thank you again. > -- > Posted viahttp://www.ruby-forum.com/.Slow down and think. You can store files in the local filesystem in places other than your Rails apps /public directory. hitch linked you to http://api.rubyonrails.org/classes/ActionController/Streaming.html; send_file is a good place to start. (Though in practice this just tends to be good at tieing up a specific Rails instance during the file sending process and you''ll eventually use something like mod_xsendfile, but take one thing at a time!)
pharrington wrote:> On Aug 13, 3:06�pm, Siddharth Ravichandran <rails-mailing-l...@andreas- > s.net> wrote: >> >> Thank you again. >> -- >> Posted viahttp://www.ruby-forum.com/. > > Slow down and think. You can store files in the local filesystem in > places other than your Rails apps /public directory. hitch linked you > to http://api.rubyonrails.org/classes/ActionController/Streaming.html; > send_file is a good place to start. (Though in practice this just > tends to be good at tieing up a specific Rails instance during the > file sending process and you''ll eventually use something like > mod_xsendfile, but take one thing at a time!)Thank you very much. That was really helpful. I have decided to store the application on a different folder and I use send_file to play the music. Thank you very much again. -- Posted via http://www.ruby-forum.com/.