I have a question about load local files by my application.
I use this code to view a flash video in my app:
This works fine until my swf file is in myapp/app/assets/…
Can I load a flash video from, for example, C:/Videos ? I found nothing
I tried to create a link like this:
<%= link_to “Video”, ‘file:///C:/Videos/file.swf’, :method => ‘post’ %>
but not work.
Thanks in advance.
Your link would render a link on the local user’s computer to
“file:///C:/Videos/file.swf” - basically, it would link to that file on
user’s computer, not the file on the server.
You will have to either place the file within the Web application (under
public or assets), or build a controller method to stream what looks
a file in the Web application from the file stored locally. Something
bytes = # load file into variable
send_data(bytes, :filename => “file.swf”, :type => “application/
That may or may not be the best way though, depending on the size of
file, because the file will be loaded into memory. Some sort of
might be necessary - read up on that.