Thanks Matt and Bill,
I tried using send_file (both with and without the xsendfile option).
Same results either way. I wind up with a 1 byte file being downloaded.
I tried changing my path to be in the public folder in case that
matters. No joy. Currently my path is:
@temp_download_file_path =
"#{Rails.root}/public/#{modified_email}.csv"
My action to do the download looks like this:
def send_the_file
@temp_download_file_path = session[:temp_file_path]
send_file @temp_download_file_path,
:x_sendfile => true,
:type => 'text/csv',
:filename => "contacts.csv"
end
No errors are generated. Log says it is sending it. I wind up with a 1
byte file on the other end.
Thanks for any additional help you guys can provide.
thanks,
jp
Matt Harrison wrote:
> Jeff Pritchard wrote:
>> what's wrong to tell for sure.
>>
>>
>> jp
> A link with file:// will only work if the file is on the current
> machine. For example:
>
> file:///mypath/myfile
>
> will download a file from /mypath/myfile *on the local machine* if it
> exists.
>
> What you are probably wanting is to create the file in a temporary
> directory as you have done, but then serve it up with a proper link.
>
> You might want to look at send_file or send_data to read the contents
> from the file and directly send it to the users browser. you will have
> to put this inside another action.
>
> HTH
>
> Matt
--
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
-~----------~----~----~----~------~----~------~--~---