samedi 25 mars 2017

Rails files upload on production

I trying to upload an image on my local server with carrierwave there are no errors. But when i've tryed to upload same image on my production server i've validation errors (type of file, and empty field form). I also check rules, and in my public/uploads i've seted 777 What can it be?class ApplicationUploader < CarrierWave::Uploader::Base

include CarrierWave::MiniMagick

  storage :file

  def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  end

  def extension_white_list
    %w(jpg jpeg gif png)
  end

  def filename
    if original_filename
      @name ||= Digest::MD5.hexdigest(File.dirname(current_path))
      "#{@name}.#{file.extension}"
    end
  end

  def auto_orient
    manipulate!(&:auto_orient)
  end

  version :admin_thumb do
    process :auto_orient
    process resize_to_fit: [100, 100]
  end

  version :category_thumb do
    process :auto_orient
    process resize_to_fill: [327, 258]
  end

  version :list_thumb do
    process :auto_orient
    process resize_to_fill: [150, 115]
  end


end

my carrierwave uploader:

Aucun commentaire:

Enregistrer un commentaire