DRY means Don't Repeat Yourself, a common mantra for rails developers. For instance, using one of the above mentioned plugins means this will probably be taken care of for you.
If you're on rails 1.2 and were looking at acts_as_attachment, I'd suggest my refactored update attachment_fu. It has an #uploaded_data accessor that handles the above code in your model.