Forum: Ruby on Rails Creating a tar file for download

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A1247f73598357f06388e863c41aa624?d=identicon&s=25 Elias Orozco (elioncho)
on 2009-03-02 17:26
(Received via mailing list)
Hello,

I have an action on my controller named download which creates a tar
file and then sends the file (via send_file) to the user. Its working
but I will like to delete the file once it is sent. The tar file
should be temporary and only available for download and then deleted
from the server. Any idea on how to do this?
Thanks,

def download
  @app = App.find params[:id]
  system('cd '+$global_path+@app.name+' && tar -cf '+@app.name+'.tar
')
  send_file $global_path+"#{@app.name}/#{@app.name}.tar"
end
A1247f73598357f06388e863c41aa624?d=identicon&s=25 Elias Orozco (elioncho)
on 2009-03-02 22:11
(Received via mailing list)
Basically I just want to be able to delete the file one it is
download. Any ideas?
This topic is locked and can not be replied to.