# Action to Render Image for Download

**URL:** <https://www.ruby-forum.com/t/action-to-render-image-for-download/168114>\
**Category:** Rails\
**Created:** [May 16, 2009, 4:16am UTC](https://www.ruby-forum.com/t/action-to-render-image-for-download/168114 "2009-05-16T04:16:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgiorno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mgiorno](https://www.ruby-forum.com/u/mgiorno)\
**Post date:** [May 16, 2009, 4:16am UTC](https://www.ruby-forum.com/t/action-to-render-image-for-download/168114/1 "2009-05-16T04:16:56Z")

</div>

Hi,

I’m trying to set up an action that will send an image to the browser as  
an attachment for download using paperclip. Sadly, I keep getting  
stuck. Insead, I keep sending an empty image to the browser. Anyone  
have any luck or any ideas?

def download\_image  
art = Art.find(params[:id])  
send\_file art.list\_image.url(:original), :type =\>  
art.list\_image\_content\_type, :disposition =\> ‘attachment’  
end

Thanks so much.

---

<div class="post-metadata">

**Author:** ![mgiorno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mgiorno](https://www.ruby-forum.com/u/mgiorno)\
**Post date:** [May 16, 2009, 8:50am UTC](https://www.ruby-forum.com/t/action-to-render-image-for-download/168114/2 "2009-05-16T08:50:43Z")

</div>

I got it, with the help of a friend.

send\_file art.list\_image.path(:original), :type =\>  
art.list\_image\_content\_type, :disposition =\> ‘attachment’, :filename =\>  
art.id
