diff --git a/app/controllers/volume_controller.rb b/app/controllers/volume_controller.rb index 211e717..c76c8e2 100644 --- a/app/controllers/volume_controller.rb +++ b/app/controllers/volume_controller.rb @@ -72,8 +72,16 @@ class VolumeController < ApplicationController mnt_dest = mnt_dir + "/" + file.original_filename puts "upload start" - u = AvatarUploader.new - u.store_path(:dir) + # get permission +# dir_left = mnt_dir[0..mnt_dir.rindex('/')] +# dir_right = mnt_dir.split(dir_left)[1] +# pe = `ls -al #{dir_left} | grep #{dir_right}`.split(" ")[0] + +# puts "111" + dir_left +# puts "222" + dir_right +# puts "333" + pe + + u = AvatarUploader.new(mnt_dir) u.store!(file) puts "upload end" diff --git a/app/uploaders/avatar_uploader.rb b/app/uploaders/avatar_uploader.rb index 7aaaf32..0a81dca 100644 --- a/app/uploaders/avatar_uploader.rb +++ b/app/uploaders/avatar_uploader.rb @@ -9,10 +9,17 @@ class AvatarUploader < CarrierWave::Uploader::Base # Choose what kind of storage to use for this uploader: storage :file # storage :fog + @path + + def initialize(dest = "/mnt/dir") + super + @path = dest + end # Override the directory where uploaded files will be stored. # This is a sensible default for uploaders that are meant to be mounted: - def store_dir + def cache_dir + @path end # Provide a default URL as a default if there hasn't been a file uploaded: diff --git a/app/views/volume/index.html.erb b/app/views/volume/index.html.erb index 924df1e..dcf8f94 100644 --- a/app/views/volume/index.html.erb +++ b/app/views/volume/index.html.erb @@ -230,7 +230,10 @@ new_tr += "