简体   繁体   English

Rails文件在生产中上传

[英]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? 我还要检查规则,在我的公共/上传文件中,我已将777设置为什么?

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: 我的载波上传器:

我已经用yum install ImageMagic修复了它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM