[Rails] send_data/send_file does not open a save as dialog box

2012-06-01 Thread ryepie
Hello, We are using JRuby 1.5.1/ruby 1.8.7/Rails 2.3.8 with a GWT front end. I'm having an issue when attempting to send a server side .csv file to the user using rails send_file. my code is: send_file(path_to_file, type=>'text/csv') While this is returning fine with an http status of 200, the

Re: [Rails] send_data always sends xml file?

2012-03-15 Thread Chris Morris
"Mac thinks it's an xml file." -> Does the file end up with an .xml extension in your Downloads dir? and/or when you try to open it some program registered to .xml extension opens it or what? Which browser and what do you see in the Response headers? All browsers do the same thing? -- Chris htt

[Rails] send_data always sends xml file?

2012-03-13 Thread Jeff Pritchard
I'm trying to use send_data to send a simple text file. Every reference I can find says I can supply a MIME type with the ":type" option and that will determine the kind of file I get on the machine that downloads the file I'm sending. Instead I ALWAYS get an XML file. here's the code snippet:

Re: [Rails] Send_data with a layout?

2011-02-17 Thread Peter De Berdt
On 17 Feb 2011, at 15:34, David Zhu wrote: I'm using send_data to retrieve binary (images) from the database. It works fine, this is my controller : @picture = Picture.find(params[:id]) @image = @picture.image_file send_data (@image, :type => @picture.image_content_type, :filename => @p

[Rails] Send_data with a layout?

2011-02-17 Thread David Zhu
Hello, I'm using send_data to retrieve binary (images) from the database. It works fine, this is my controller : @picture = Picture.find(params[:id]) @image = @picture.image_file send_data (@image, :type => @picture.image_content_type, :filename => @picture.image_file_name, :disposition

Re: [Rails] send_data damaging the PDF document

2011-02-01 Thread Peter De Berdt
On 01 Feb 2011, at 14:41, Tushar Gandhi wrote: I am uploading a PDF file using paper clip. File get uploaded successfully. If I try to view the file directly from file system it is opening. I have to open the file from application so I have written following code. View Code:- <%= link_to 'Vi

[Rails] send_data damaging the PDF document

2011-02-01 Thread Tushar Gandhi
Hi, I am uploading a PDF file using paper clip. File get uploaded successfully. If I try to view the file directly from file system it is opening. I have to open the file from application so I have written following code. View Code:- <%= link_to 'View Attachment', {:action=>"show_attachment", :id=>

Re: [Rails] Send_data

2010-06-28 Thread Michael Pavling
On 28 June 2010 21:45, dieinzige wrote: > what the hell are u doing, if u have file, u can simplify get link to user, What if the OP needs users to be logged in to view files? Or complete some other approval process. Not much sense having them accessible from the public directory in that instance

Re: [Rails] Send_data

2010-06-28 Thread dieinzige
what the hell are u doing, if u have file, u can simplify get link to user, for it it will be more faster than use rails, and more native for user Best Regards, dieinzige On 28 Jun, 2010,at 03:56 PM, Mamadou Touré wrote: I want to display a pdf on my browser bu using send_data(File.read(FIL

Re: [Rails] Send_data

2010-06-28 Thread Peter De Berdt
On 28 Jun 2010, at 17:56, Mamadou Touré wrote: I want to display a pdf on my browser bu using send_data(File.read(FILE_PATH + FILE_NAME), :type => 'application/pdf',:disposition => 'inline', :filename => FILE_NAME) But nothing happens. Do you know why ? Serving it via AJAX or a normal reques

[Rails] Send_data

2010-06-28 Thread Mamadou Touré
I want to display a pdf on my browser bu using send_data(File.read(FILE_PATH + FILE_NAME), :type => 'application/pdf',:disposition => 'inline', :filename => FILE_NAME) But nothing happens. Do you know why ? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are s

[Rails] send_data => invalid byte sequence in US-ASCII

2010-04-29 Thread Fearless Fool
I'm trying to display a generated .png plot via send_data(), but it results in a server error "invalid byte sequence in US-ASCII" error. I'm pretty sure this means that I need to specify the encoding somewhere, but I haven't been able to figure out where or how to do so. Some particulars: I'm run

[Rails] send_data with jpeg not working

2009-11-08 Thread flag
I'm a newbie having trouble using send_data to send a jpeg file to the browser for display in an html img tag. This is the relevant code from my controller (photos_controller.rb): def retrieve @photo = Photo.find(params[:id]) send_data File.read(@photo.abs_img_path), :type => "image/ jpeg",