• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 426
  • Last Modified:

How to access local hard drive in ruby on rails

Hai all,

I am a newbie to ruby on rails and I am working on a project where I need to embed a flash video which has been stored on my local hard drive in my view page. Is there a way I can do it?

  • 2
  • 2
2 Solutions
Geert BormansCommented:
That is generally not a good idea. A web application should not access a local hard drive as the local hard drive,
but should access it as a virtual folder. You should put the flash video behind the server.
There are two options for that
- simply put the video in the public folder: \public\images
The disadvantage of that is that each request for the video will pass your Ruby on Rails server, with a bad effect on performance
- put your rails server behind an apache server and link requests for rails throught to the rails server, but handle images and movies directly through apache
This will be beneficial for performance. Do it this way, if you expect a lot of traffic to the flash video
sreekanthvasireddyAuthor Commented:
Hai Gertone,

Thank you for your reply.

I think I understand what you said, but am unsure about the second method you said. I am sorry I should have been more elaborate earlier and given you more information. Let me explain my circumstance to the best I can.

I am working on a project where I am thinking of allowing the user to post a video message and view it at a later date. He can do so as I will display a list of messages that the user created. It is in Ruby on Rails. I am able to record the video using a tool called 'Red5recorder', but the problem is the recorder does not work with 'http' protocol, it needs 'rmtp'. Red5recorder requires us to run a rtmp server which is in c:\programfiles\red5recorder\ on my local system.

My question is:

Can we access the flv file which is in c:\programfiles\red5recorder\ from my rails. If so, how?

Thank you for your time.

Geert BormansCommented:

you did not give me much time to give you more detail :)

I think you would best keep the videos close to your rails environment... not safe, but you could bring your rails environment close to the red5recorder path.

Note that configuring apache, which is what I would do, to pull the videos from that directory is a better option. You don't want to pull all these video files through the Ruby on Rails server. That will be very bad for performance.

Just make an alias to the red5recorder path in apache. There is an apache TA on Experts Exchange where people can help you further configuring apache if you don't succeed
I really recommend you to use apache in front of the railsserver, for projects like this

Anyway, you found another approach, which is good.

Please take note of two things
- if you found another approach, please post it here for future reference. It might be helpfull to others
- allthough you did not hear what you wanted to hear in this question, the answer given is still valuable. You can't simply close the question without giving credit to the effort taken, putting you in the right direction... that is why I object to you closure
sreekanthvasireddyAuthor Commented:
Hai Gertone,

You can't simply close the question without giving credit to the effort taken, putting you in the right direction... that is why I object to you closure

I am sorry If I was not clear. The other approach I talked about is we are looking for plugins which I think I found as a wordpress plugin. As this was taking up too much time and my boss wants its done ASAP. I also awarded you points to you, because you were the only who replied. We are working to see if we create the same functionality in wordpress, so if that works out, I will surely post it here. Sorry for the confusion if any.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now