for filename specify your filename directly with filepath
for e.g @filepath = "C:/Rails
application/smartime/public/excel/"+"report8.xls"
and then pass this variable for filename
It might work
Siva wrote:
> I tried the same in my code. But always the browser is getting only
> the action name itself as the filename and it says it cannot find the
> file. Here is the code snippets from my application.
>
> Controller code :
>
> @filepath = "C:/Rails application/smartime/public/excel/"
> @filename = "report8.xls"
> send_file(@filepath + @filename,
> :disposition => 'attachment',
> :encoding => 'utf8',
> :type => 'application/octet-stream')
>
> View code:
> <% form_tag({ :action => :exportToExcel })do %>
> <td width="35%" height="25%" align="left">
> <%= submit_tag 'Export To Excel' %>
> </td>
> <%end%>
>
> When I click on the "Export to excel button", the file is created in
> the server. The browser shows the file download window. But it shows
> the file name as "exportToExcel". When I click on save it shows error
> message "Internet explorer cannot download exportToExcelfrom
> localhost". I am running the server in localhost.
>
> What is missing in the code I am using?
>
> Thanks in advance.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---