# Paperclip - deleting a photo from a form

**URL:** <https://www.ruby-forum.com/t/paperclip-deleting-a-photo-from-a-form/150529>\
**Category:** Rails\
**Created:** [October 9, 2008, 3:34pm UTC](https://www.ruby-forum.com/t/paperclip-deleting-a-photo-from-a-form/150529 "2008-10-09T15:34:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [October 9, 2008, 3:34pm UTC](https://www.ruby-forum.com/t/paperclip-deleting-a-photo-from-a-form/150529/1 "2008-10-09T15:34:53Z")

</div>

Any tips as to how paperclip can be used to delete photos.

I mean that in my update view I show six browse buttons, all capable of  
updating the photo that corresponds to that browse button (e.g. photo1  
or photo2). That works, what if the user wants to delete one of those  
photos, how do I do that?

bb

---

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [October 9, 2008, 4:53pm UTC](https://www.ruby-forum.com/t/paperclip-deleting-a-photo-from-a-form/150529/2 "2008-10-09T16:53:52Z")

</div>

bingo bob wrote:

> Any tips as to how paperclip can be used to delete photos.
> 
> I mean that in my update view I show six browse buttons, all capable of  
> updating the photo that corresponds to that browse button (e.g. photo1  
> or photo2). That works, what if the user wants to delete one of those  
> photos, how do I do that?
> 
> bb

Looking to find out what I need to do in my view and in my controller.

---

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [October 12, 2008, 10:02am UTC](https://www.ruby-forum.com/t/paperclip-deleting-a-photo-from-a-form/150529/3 "2008-10-12T10:02:24Z")

</div>

For reference, here’s the edit view for an advert, as I say, I’m trying  
to integrate a fiunction that allows users to delete one of the photos  
(1 to 6), any clues as to what i might do in this form / controller.

# Editing advert

\<%= render :partial =\> “images”, :locals =\> { :advert =\> @advert } %\>

\<% form\_for @advert, :html =\> { :multipart =\> true } do |f| %\>

\<%= f.error\_messages %\>

- \<%= f.file\_field :photo1%\>
- \<%= f.file\_field :photo2%\>
- \<%= f.file\_field :photo3%\>
- \<%= f.file\_field :photo4%\>
- \<%= f.file\_field :photo5%\>
- \<%= f.file\_field :photo6%\>

\<%= f.label :title %\>  
 \<%= f.text\_field :title %\>

\<%= f.label :description %\>  
 \<%= f.text\_area :description %\>

\<%= f.submit "Update" %\>

\<% end %\>

\<%= link\_to ‘Show’, @advert %\> |  
\<%= link\_to ‘Back’, adverts\_path %\>

---

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [October 10, 2008, 2:01pm UTC](https://www.ruby-forum.com/t/paperclip-deleting-a-photo-from-a-form/150529/4 "2008-10-10T14:01:40Z")

</div>

Anyone have any tips on this one? I suppose I may need an additional  
action in my controller to cope with deletion of a particular photo and  
then re-render the edit view…
