attachment_fu strange behaviour with file uploading

   thr's a strange behavior with attachment_fu. when i upload a file,
sometimes it gets uploaded without prb/error msg and sometimes the same
file gives the error as size error msg. particularly, when i upload the
next file immediately after another. can anybody help me in this? thanks
in advance...

this is my mugshots model:-
class Mugshot < ActiveRecord::Base
  has_attachment :content_type => ['application/'],
                   :storage => :file_system,
                   :max_size => 5.megabytes,
# validates_as_attachment
  def validate
    errors.add_to_base("You must choose a file to upload") unless
    unless self.filename == nil
      # Images should only be GIF, JPEG, or PNG
      [:content_type].each do |attr_name|
        enum = attachment_options[attr_name]
        unless enum.nil? || enum.include?(send(attr_name))
          errors.add_to_base("You can only upload .xls file")
      # Images should be less than 5 MB
      [:size].each do |attr_name|
        enum = attachment_options[attr_name]
        unless enum.nil? || enum.include?(send(attr_name))
          errors.add_to_base("file size should be smaller than 5 MB in


hi Reinhart,
   hey, that worked!!! though "errors.add attr_name,
ActiveRecord::Errors.add_to_base("You can only upload .xls file")unless
enum.nil? || enum.include?(send(attr_name))" gave me NoMethod error, so
i kept the default line back. that gave me default error msg for wrong
upload. but that worked.
   and even if i put ":size => 0.megabyte..5.megabytes," line in my
code, that also worked fine :slight_smile:
   now i could upload the files continuously... without error :smiley:

   Thanks a ton Reinhart