ruby on rails - Errno::EACCES: Permission denied @ dir_s_mkdir - /uploads while unzipping -
i unzipping file uploaded using carrierwave , running code on localhost using console. file there in uploads folder , need unzip reading contents.
zip::file.open(rails.root.to_s + "/public" + self.submission.file_path.to_s) { |zip_file| puts zip_file.inspect zip_file.each { |file| file_path = file.join("solution", file.name) fileutils.mkdir_p(file.dirname(rails.root + "/public" + self.submission.file_path.to_s)) zip_file.extract(file, file_path) unless file.exist?(file_path) } }
and giving me error
errno::eacces: permission denied @ dir_s_mkdir - /uploads /users/linux/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/fileutils.rb:252:in `mkdir' /users/linux/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/fileutils.rb:252:in `fu_mkdir' /users/linux/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/fileutils.rb:226:in `block (2 levels) in mkdir_p' /users/linux/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/fileutils.rb:224:in `reverse_each' /users/linux/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/fileutils.rb:224:in `block in mkdir_p' /users/linux/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/fileutils.rb:210:in `each' /users/linux/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/fileutils.rb:210:in `mkdir_p' /users/linux/documents/rails/recruitment/app/models/candidate.rb:22:in `block (2 levels) in unzip_solution' /users/linux/.rvm/gems/ruby-2.2.1/gems/rubyzip-1.1.7/lib/zip/entry_set.rb:42:in `call' /users/linux/.rvm/gems/ruby-2.2.1/gems/rubyzip-1.1.7/lib/zip/entry_set.rb:42:in `block in each' /users/linux/.rvm/gems/ruby-2.2.1/gems/rubyzip-1.1.7/lib/zip/entry_set.rb:41:in `each' /users/linux/.rvm/gems/ruby-2.2.1/gems/rubyzip-1.1.7/lib/zip/entry_set.rb:41:in `each' /users/linux/.rvm/gems/ruby-2.2.1/gems/rubyzip-1.1.7/lib/zip/central_directory.rb:182:in `each' /users/linux/documents/rails/recruitment/app/models/candidate.rb:20:in `block in unzip_solution' /users/linux/.rvm/gems/ruby-2.2.1/gems/rubyzip-1.1.7/lib/zip/file.rb:99:in `open' /users/linux/documents/rails/recruitment/app/models/candidate.rb:18:in `unzip_solution' ... 2 levels... /users/linux/.rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/commands/console.rb:9:in `start' /users/linux/.rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:68:in `console' /users/linux/.rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:39:in `run_command!' /users/linux/.rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/commands.rb:17:in `<top (required)>' /users/linux/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:274:in `require' /users/linux/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:274:in `block in require' /users/linux/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:240:in `load_dependency' /users/linux/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:274:in `require' /users/linux/documents/rails/recruitment/bin/rails:9:in `<top (required)>' /users/linux/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:268:in `load' /users/linux/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:268:in `block in load' /users/linux/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:240:in `load_dependency' /users/linux/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:268:in `load' /users/linux/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' /users/linux/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
Comments
Post a Comment