On 7 Dec 2011, at 07:45, Ajit Teli <[email protected]> wrote:
> I created a file 'csv_string' as follows > > ... > > I am able to download the file using > > "send_data csv_string, :type => "application/csv", :filename > =>"rawdata.csv" > > But I am unable to download same file using > > "send_file csv_string, :type => "application/csv", :x_sendfile=> true, > :filename => "rawdata.csv" > > It gives the error saying that string contains null byte. > > Can anyone please help me in resolving this issue? > Xsendfile can only send actual files from the server's hard disk. You don't have a file, just a string containing some data. You could write the file to disk and use Xsendfile to send that, but depending on the file size it might not be worth it. You'd also need to clean up files once they'd been sent Fred > > Thank you > > -- > 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. > -- 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.

