0

The folllowing error appears in my logs when i try to upload a file with carrierwave.

Errno::EPERM (Operation not permitted @ chmod_internal - /home/daniel/public/my_app/public/uploads):               app/controllers/admin/file_uploads_controller.rb:21:in `manual' 

This happens when i execute the following action:

def manual
    Product.where(distributor: 'handmatig').map{|c| [c.update(deleted: true)]}

    @file_upload = FileUpload.new(file_upload_params)
    @file_upload.name = "united"

    if @file_upload.save
      flash['notice'] = "Uw bestand is geupload."
      redirect_to :back
    end
  end

Line 21 is the line that holds if @file_upload.save.

I tried using sudo chmod -R 777 public/uploads/, but it doesnt appear to help.

What is causing this error and how do i get passed it? I wish i was more familiar with permissions.

Daniel B
  • 72
  • 1
  • 9
  • Possible duplicate of [ERROR: While executing gem ... (Errno::EPERM) Operation not permitted](https://stackoverflow.com/questions/32891965/error-while-executing-gem-errnoeperm-operation-not-permitted) – MarsAtomic Aug 04 '17 at 12:02
  • I had this error saving files to a Windows network drive, mounted via CIFS on my Ubuntu server. Adding the `noperm` option to fstab resolved the issue for me. This option means "client does not do permission checks," which effectively makes CarrierWave's chmod a no-op, I think. The security implications of that don't matter in my context, but you should do your own evaluation, `man mount.cifs`. – Alric Jun 02 '18 at 06:33

0 Answers0