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

2012-06-19 Thread Frederick Cheung
On Jun 18, 10:51 pm, ray wrote: > same problem. save_file fails. no user dialog box to open or save the > file. > > send_file(path, :type => "application/pdf", :disposition => "inline" ) > > works in Rails 2 > fails in Rails 3 with Activescaffold and webrick or thin. > inline means that the bro

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

2012-06-18 Thread ray
same problem. save_file fails. no user dialog box to open or save the file. send_file(path, :type => "application/pdf", :disposition => "inline" ) works in Rails 2 fails in Rails 3 with Activescaffold and webrick or thin. I am also interested in any ideas why this isn't working? -- You receive

[Rails] Re: Send_data with a layout?

2011-02-17 Thread David Zhu
Bingo! No need for send_data in the first place. This was all i needed, in the view: <%= image_tag("/pictures/#{@picture.id}", :alt => "Image") %> Now the image displays inside a layout. Sweet. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk

[Rails] Re: send_data damaging the PDF document

2011-02-02 Thread Frederick Cheung
On Feb 2, 4:52 am, Tushar Gandhi wrote: > Hi, > Thanks for your reply, but still it is not working. send_data expects you to be giving it the actual bytes to send, not a url or a file path. You need to read the file yourself (or use send_file which will take care of that) Fred > > Any other su

[Rails] Re: send_data damaging the PDF document

2011-02-01 Thread Tushar Gandhi
Hi, Thanks for your reply, but still it is not working. Any other suggestion. Thanks, Tushar -- 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 rubyonrails-ta

Re: [Rails] Re: Send_data

2010-06-30 Thread Peter De Berdt
On 30 Jun 2010, at 18:13, Mamadou Touré wrote: Unfortunately I have to hav each file on its own, I must not merge them in on single file. Is there a way to simulate several requests in order to loop through the array ? Even if there were, the browser would not be able to understand it.

[Rails] Re: Send_data

2010-06-30 Thread Mamadou Touré
Marnen Laibow-Koser wrote: > Mamadou Touré wrote: > [...] >>> >>> >>> >>> >> Thanks Marnen, >> >> Unfortunately I have to hav each file on its own, I must not merge them >> in on single file. Is there a way to simulate several requests in order >> to loop through the array ? > > Even if the

[Rails] Re: Send_data

2010-06-29 Thread Marnen Laibow-Koser
Mamadou Touré wrote: [...] >> >> >> >> > Thanks Marnen, > > Unfortunately I have to hav each file on its own, I must not merge them > in on single file. Is there a way to simulate several requests in order > to loop through the array ? Even if there were, the browser would not be able to un

[Rails] Re: Send_data

2010-06-29 Thread Marnen Laibow-Koser
Mamadou Touré wrote: [...] >> >> >> >> > Thanks Marnen, > > Unfortunately I have to hav each file on its own, I must not merge them > in on single file. Is there a way to simulate several requests in order > to loop through the array ? Even if there were, the browser would not be able to un

[Rails] Re: Send_data

2010-06-29 Thread Mamadou Touré
Marnen Laibow-Koser wrote: > Mamadou Touré wrote: > [...] >> >> I'm having the file displayed now, but the other issue that I'm facing >> now is : I have several files to open, I put them in an array that I >> loop through, but only the last file is opened: >> >> What's wrong ? >> >> arr.each

[Rails] Re: Send_data

2010-06-29 Thread Marnen Laibow-Koser
Mamadou Touré wrote: [...] > > I'm having the file displayed now, but the other issue that I'm facing > now is : I have several files to open, I put them in an array that I > loop through, but only the last file is opened: > > What's wrong ? > > arr.each do |form| > file_name = form + "-

[Rails] Re: Send_data

2010-06-29 Thread Mamadou Touré
Michael Pavling wrote: > 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

Re: [Rails] Re: Send_data

2010-06-28 Thread Peter De Berdt
On 28 Jun 2010, at 19:28, Mamadou Touré wrote: Peter De Berdt wrote: 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 not

[Rails] Re: Send_data

2010-06-28 Thread Mamadou Touré
Peter De Berdt wrote: > 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 ? >

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

2010-04-30 Thread Fearless Fool
Sharagoz wrote: > I dont know if it's related to the actual error message you are > getting, but I believe your send_data call should look more like this: > send_data(report.imagedata, :disposition => 'inline', :type => 'image/ > png', :filename => "graph.png") > You are setting it to a GIF, and no

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

2010-04-30 Thread Sharagoz
I dont know if it's related to the actual error message you are getting, but I believe your send_data call should look more like this: send_data(report.imagedata, :disposition => 'inline', :type => 'image/ png', :filename => "graph.png") You are setting it to a GIF, and not setting the disposition

[Rails] Re: send_data with jpeg not working

2009-11-08 Thread flag
okay here's the solution (graciously provided by someone on stackoverflow.com) -- I modified the retrieve action in my controller to use File.open first: def retrieve @photo = Photo.find(params[:id]) File.open(@photo.abs_img_path, 'rb') do |f| send_data f.read, :type => "image/jpeg", :di

[Rails] Re: send_data with jpeg not working

2009-11-08 Thread flag
A little more info now... when I simulate the img tag request by typing www.myapp.com/photos/5/retrieve into the browser, I get the following line in my Apache access.log: "GET /photos/5/retrieve HTTP/1.1" 304 0 whereas if I type in the url to one of my public images (www.myapp.com/ images/logo.