send_file : downloaded file cannot be open after upload OK

Don’t redirect at the end of your for one. No new page will be rendered anyway (the user will just get the download dialog).

Also don’t make things more complicated than they need to be:

def download

@document = Document.find(params[:id])

send_file(@document.full_filename,

:filename => @document.filename,

:type => @document.content_type,

:disposition => ‘attachment’)

end

Best regards

Peter De Berdt