Hi All,
i would like to know ,is mod x_sendfile0.11.1 is compatible with
apache 2.2.16
Amit T. wrote:
Hi All,
i would like to know ,is mod x_sendfile0.11.1 is compatible with
apache 2.2.16
yaa its compatible with apache 2.2.16 but XSendFileAboveAll is replaced
by XSendFilePath …
I created a file ‘csv_string’ as follows
def export_raw
@device = Device.find_by_id( params[:id] )
@messages = @device.devmessages.all( :order => “id”, :conditions =>
[“packettime >= ? and packettime <= ?”, params[:start_time],
params[:end_time]] )
csv_string = FasterCSV.generate do |csv|
csv << [“Packet”, “Server Receive Time”]
@messages.each_with_index do |m,i|
x = m.created_at
csv << [m.message, x.strftime(’%h %d, %G %r’)]
end
end
send_file csv_string, :type => “application/csv”, :x_sendfile=> true,
:filename => “rawdata.csv”
send_data(csv_string,
:type => ‘text/csv; charset=utf-8; header=present’,
#:filename => filename)
end
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?
Thank you
On 7 Dec 2011, at 07:45, Ajit T. [email protected] wrote:
"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