Displaying 20 results from an estimated 6000 matches similar to: "Error in send_file"
2006 Aug 08
2
send_file problem
I''m attempting to use send_file to send an image file from 
public/images.  The file is world readable.
I keep getting the following error:
A ActionController::MissingFile occurred in account#current_logo: 
Cannot read file public/images/logo.png 
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/streaming.rb:55:in 
`send_file''
I''ve tried supplying
2006 Dec 30
2
Another RSpec on Rails issue: how to test send_file()
Hi!
Today I needed to implement some controller code, that uses send_file()
to send image data. How can this be tested / specified with RSpec?
bye,
Tobias
2007 Feb 12
6
Cannot send_file then delete it
My application accepts a form to create multiple large(100''s of MB)
temporary files and then zip''s them up to send off to a user.
I have the files constructed, and the zipping working. The problem is
that if I use send_file to send the zip off to the user, I cannot
delete the file afterwards as it seems send_file forks off another
process and deletes the file before the
2006 Feb 20
3
RAILS_ROOT
I just replied to someone about using send_file and while I was testing my solution I 
figured out that the controllers "current working dir" appears to be the root of the app.
Then I saw a reply that Ezra sent to someone where he used RAILS_ROOT and I thought "duh, 
I''ve seen that before... shoulda used that".
But, when I had an action print out RAILS_ROOT
2010 Nov 03
2
send_file but not send_data?
So this is the original code I used, and it worked
send_file ''vendor/sprites/not-found.png'', {:filename =>
"sprite-not-found.png", :type => "image/png", :disposition => "inline"}
Now I switched it to this (going to be adding imageMagick)
send_data File.read(''vendor/sprites/not-found.png''), {:filename =>
2006 Apr 05
1
send_file VS. send_data (performance)
Does anybody know if there is a big performance/time cost difference 
between these two methods of serving a file:
------------------------------- #1 
-----------------------------------------
send_file "test.png", :type => ''image/png'', :disposition => ''inline''
------------------------------- 
#2------------------------------------------
2007 Feb 28
8
Export/save csv-file to desktop of user?
Hi,
looking for something that simple, but can''t find it. I got:
  outfile = File.open(''teams.txt'', ''wb'')
    CSV::Writer.generate(outfile) do |csv|
      for team in @teams
      csv << [team.id, team.name]
      end
    end
    outfile.close
    send_file "teams.txt", :filename => "teams.txt",:disposition =>
2007 Feb 22
0
error with send_file.. please help me...
Ben wrote:
> API is your friend.
> http://api.rubyonrails.org/classes/ActionController/Streaming.html#M000091
> send_file
I put this code block in files_controller.rb
  def send_file(path, options = {}) #:doc:
        raise MissingFile, "Cannot read file #{path}" unless
File.file?(path) and File.readable?(path)
        options[:length]   ||= File.size(path)
       
2007 Feb 23
1
How to make Rails send a file that is being written
I''m trying to build a simple proxy to Amazon S3 that would allow a
client to request a url that gets mapped to a S3 Object by Rails and
streamed back to the client.
For S3 integration, I use the highly recommended gem AWS::S3
(http://amazon.rubyforge.org/), and to send a file, I simply use the
send_file function.
The concept works BUT the I can''t get the file to be sent as
2007 Apr 23
4
send_file pdf problem
Hi,
I am using send_file to allow users to download files from my website,
please see code beloe:
def download_document
  send_file("#{RAILS_ROOT}/public/test_form.pdf",
            :filename      =>  "test.pdf",
            :type             =>  ''application/pdf'',
            :disposition  =>  ''attachment'',
            :streaming 
2012 May 31
2
send_data/send_file does not open a save as dialog box
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 client
side save as dialog is never opening for the user to receive
2005 Dec 20
0
2005 a send_file odyssey (or Rails and Apache don''t always play well)...
Hi,
I''m developing a Rails application that (amongst other things)
lets users download media files.  These files range in size
from a few kilobytes up to several gigabytes.
All this development is taking place with Rails 1.0 on a
Solaris host with Ruby 1.8.2 and Rails mode set to
"development".
I''m using the Rails send_file method to send each file with
these
2007 Jun 07
6
Can't download files with send_data or send_file
I have a form_remote_tag that calls a method to print out a csv file
for download.  If I tell the form_remote_tag to update a div the data
comes up in that div, but otherwise I can''t  get the browser to
acknowledge the sent file.
>From view:
   <%= form_remote_tag :url => {:action => "csv_dump" }%>
   <%= submit_tag "Download Complete List" ,:name
2006 Feb 28
1
ArgumentError (string contains null byte) -- file upload problem
Hi,
Controller code:
    if params[:main_image]
      image = Image.new
      image.blob = params[:main_image].read
      @product.main_image.destroy if @product.main_image
      @product.main_image = image
    end
When I try to display the image using send_data, I get the following error:
ArgumentError (string contains null byte):
   
2006 Jun 06
9
How to protect images from public?
Hi,
I''m trying to figure out the best way to protect images uploaded by 
users who may wish to keep them private.
For example, if they are uploaded in the default file_column location 
(/public/blah/blah/1/) then someone can simply type the URL 
http://www.blah.com/blah/blah/1 and get the image.
I can store the images in a non-public directory in the rails app (ie: 
/railsapp/images/X/)
2009 Mar 14
2
Rails, lighttpd and the Expires header
I have a controller that serves up images from a different location  
from /public/images/ by using send_file or send_data on /media/thumbs/ 
38 for example
In lighttpd I have:
expire.url = ( "/media/" => "access 10 years",
	       "/stylesheets/" => "access 10 years" ,
                "/javascripts/" => "access 10 years",
    
2006 Oct 25
7
Sending a file *and* rendering a page
Anyone know how to send a file/data to the user agent (download it)
using #send_file or #send_data, *and* render a new page in the same
action?
This just sends the file and doesn''t render the page:
  def gimme
    ...
    send_data(our_data, :filename => ''output.csv'', :disposition =>
''attachment'')
  end
And this will give a Double-Render error:
2006 Nov 30
3
Strange send_file problem
Or perhaps I am stumbling in newbie fashion (tho I have active_merchant
and a store site basically up and running in development mode - still I
don''t feel I always understand what is going on.)
So, when I have
  send_file(filename, :type => ''application/x-zip'')
  redirect :action => index
the send_file seems to hang, rather than complete. I''m deducing
2006 Jun 16
10
Issue with caching of .PNG files in IE..
I''m running a Rails  application with WEBrick server. We are displaying 
an Image from the server to the Client (Browser). First time on the 
browser everything looks fine, upon clicking the link, it contacts the 
server and displays in IE brwoser the image that was stored on the 
server.
But in case if the image gets changed on the server(File Name being the 
same), then even though i
2005 Dec 13
3
send_file doesn't work with Apache?...
Hi,
I''ve been using send_file in my Rails application with
WEBrick happily to send files of various sizes and
kinds.
The same code fails to send anything but a 500 error
when run under Apache, and a log file message
"warning: syswrite for buffered IO".
Looking back through the mailing list archives I see that
there have been send_file bugs in the past.  Can some
knowledgeable