I''m writing an application that will allow users to select several
files
from a list, and will then return a tar.gz archive to them. The relevant
part of the code looks something like this:
--------
if system("cd #{@dir}; tar czf tmp/#{@newfile} #{@add}")
send_file("#{@dir}/tmp/#{@newfile}",:disposition =>
''attachment'')
flash[:notice] = "Download complete."
#File.unlink("#{@newfile}")
else
flash[:notice] = "Download failed."
redirect_to(:action => ''view_selection'')
end
--------
This is fine as written, but if I uncomment the File.unlink then the
file is apparently deleted before the download completes, and what I get
is an html error message with @newfile''s name.
Would anyone mind point out my mistake?
--
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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---