Hi,
I have a question about load local files by my application.
I use this code to view a flash video in my app:
<embed src="<%= asset_path('file.swf') %>"/>
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
about that.
I tried to create a link like this:
<%= link_to "Video", 'file:///C:/Videos/file.swf', :method => 'post' %>
but not work.
Thanks in advance.
on 2013-02-21 14:45
on 2013-02-25 02:46
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 the *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 like a file in the Web application from the file stored locally. Something like this: def download_file bytes = # load file into variable send_data(bytes, :filename => "file.swf", :type => "application/ x-shockwave-flash") end That may or may not be the best way though, depending on the size of your file, because the file will be loaded into memory. Some sort of streaming might be necessary - read up on that.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.