I assume you have read Heroku docs for Download on S3 . The temp directory trace on Heroku is ./tmp. If you use Sinatra, Heroku probably does not create environment variables related to Rails (although this may be, I'm not sure). Here is more information about the Heroku file system.
EDIT: in Sinatra, you can get the root directory using settings.root, similar RAILS_ROOT.
source
share