similar to: send_file with stream enabled

Displaying 20 results from an estimated 60000 matches similar to: "send_file with stream enabled"

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 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 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 Dec 17
2
Error in send_file
I''m trying to add a link to download a zip file. I created a controller method that makes the call to send_file: def getzip send_file ''file.zip'' end When I navigate to this link I get a MissingFile exception. The file definitely exists (and U triple-checked paths and spelling) and the permissions are 644. I tried moving it to the /public folder and updating the
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
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
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
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",
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
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):
2005 Dec 02
0
send_file method on windows and webrick
I am developing in a windows xp environment running WEBrick and MySQL, RoR 0.13.1. I am trying to retrieve the file that I uploaded via Rails using the send_file() method. Instead of returning the file, the file''s contents are being printed out to the WEBrick console, the browser hangs for a while, and then an empty file is returned from the download dialog box (Firefox 1.0.7/IE
2006 May 14
3
send_file and locking files after download?
Hello, I''m working on a download service which grants users a one-time-download access to files. The idea is to write an entry to a database table after a successful download that "locks" the download link for the user. After doing some quick tests with send_file I noticed that send_file does not block until the user has downloaded the full file, but proceeds with the
2009 Nov 08
2
send_data with jpeg not working
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", :disposition => "inline" end def download @photo =
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
2006 May 14
1
send_file, RRDtool, require or session problem
Hi all, I am new to RoR and ruby, but am a very experience PHP developer. Let me give an overview of the problem. I have a model Latency, which contains username, graph_name so the logged in user can see his/her latency graphs. In my ViewController I have a fuction view_latency which pulls the correct latency object and runs latency.overview. latency.overview creates a .png file in /tmp, and
2006 Apr 06
1
Rmagick file conversion
I am using rmagick to convert files stored as a tiff to either pdf or jpg for display to the user. A snippet of test code from the controller follows. It works OK. ( it does need a sanitizer ) require RMagick def pdf @sdoc = Sdoc.find(params[:id]) @fname = ''/var/www/images/'' + @sdoc.fname @nf = Magick::ImageList.new(@fname)
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:
2007 Aug 27
1
Send_file() method for downloading any file
HI, I need to know how to download any file using send_file() method.The code I have shown below is for a specific file........how ever I need it for any file. THE CODE ........ def download_files send_file(''D:/hr/Handbook.doc'', :filename => params[:filename] , :type => ''application/octet-stream'',
2007 Aug 24
1
How to download any file using send_file() method
HI, I am directory listing and in that listing I have certain files and sub directories, now when I click on the files it should download that particular file but I am not able to accomplish it, and I have got to use send_file() method. In the send file Code shown below I have made use of the address of one of the files directly so when I click the link of any file it downloads it. THE CODE