CarrierWave: 1 uploader for multiple file types

I am using the carrierwave to upload files to a rails project. Right
now it works fine for uploading images but want to check if the file is
an image before attempting to resize it to avoid errors. What I’m
having trouble with is grabbing the filename of the current file it’s
trying to upload.

Ruby 1.8.7
rails 2.3.5
carrierwave 0.4.5

I used this thread as a starting point but ran into a wall

Currently my app/uploaders/my_uploader.rb looks like this

class MyUploader

version :medium do



In the place of CURRENT_FILE I’ve tried a lot of different
variable/method names from the github readme at

Each time I come up with either “no method” “uninitialized constant” or
some similar error. I also tried splitting it up into an image? method
but that method wasn’t recognized either:

class MyUploader

if image?
version :medium do


def image?

Even if the image? method was recognized I still need to get the current

I posted a reply to Nicklas on the google group page, if anyone else can
shed some light on this that would be awesome!

Many thanks in advance,


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs