If I do the following, the file exists when send_file is entered and no exception is raised at line 55 in streaming.rb where it tests for the existance of the file, but by line 67 when file.open is called the file doesn''t exist and an exception is raised. I don''t understand what is going on here. Can someone shed some light on this for me? send_file(file) File.delete(file) _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 10/7/05, snacktime <snacktime-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > If I do the following, the file exists when send_file is entered and no > exception is raised at line 55 in streaming.rb where it tests for the > existance of the file, but by line 67 when file.open is called the file > doesn''t exist and an exception is raised. I don''t understand what is going > on here. Can someone shed some light on this for me? > > send_file(file) > File.delete(file)Ok I see what''s going on, send_file just defines what the render will do. How can I delete the file after the render? _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Not an answer to your question, but personally I do temporary file deleting with a periodic cleanup process. That way, you have some data to investigate if something bad happens (and your users start asking those ''Where is my file?'' questions...). :) Of course this depends on your application and hosting environment. Thomas Am 08.10.2005 um 01:05 schrieb snacktime:> > > On 10/7/05, snacktime <snacktime-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > If I do the following, the file exists when send_file is entered > and no exception is raised at line 55 in streaming.rb where it > tests for the existance of the file, but by line 67 when file.open > is called the file doesn''t exist and an exception is raised. I > don''t understand what is going on here. Can someone shed some > light on this for me? > > send_file(file) > File.delete(file) > > > Ok I see what''s going on, send_file just defines what the render > will do. How can I delete the file after the render? > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I am trying to use send_file to stream a file to a browser. When ever the line is reached the browser just sits there and spins and Webrick outputs the contents of the file to the console. There eventually will be a file download prompt but it downloads an empty file. Any ideas? -Eric _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On Wed, 2005-10-12 at 17:27 -0600, Eric Fazendin wrote:> I am trying to use send_file to stream a file to a browser. When ever > the line is reached the browser just sits there and spins and Webrick > outputs the contents of the file to the console. There eventually > will be a file download prompt but it downloads an empty file. Any > ideas? >AFAIK webrick has a bug with send_file. You need to set :stream to false. Shouldn''t be a problem unless your files are very large... HTH Morus