From bd8d968301293825a4b16e585ba7c833fc10aaed Mon Sep 17 00:00:00 2001 From: kyg516 Date: Thu, 15 Sep 2016 17:57:20 +0900 Subject: [PATCH] Update --- app/controllers/volume_controller.rb | 12 +- app/uploaders/avatar_uploader.rb | 9 +- app/views/volume/index.html.erb | 6 +- .../tmp/1473923269-10904-0001-1439/1366.cpp | 113 ++++++++++++++++++ .../tmp/1473923499-10904-0002-5947/1366.cpp | 113 ++++++++++++++++++ .../tmp/1473923531-10904-0003-1499/1475.cpp | 33 +++++ .../tmp/1473923555-10904-0004-8765/1261.cpp | 60 ++++++++++ 7 files changed, 341 insertions(+), 5 deletions(-) create mode 100644 public/uploads/tmp/1473923269-10904-0001-1439/1366.cpp create mode 100644 public/uploads/tmp/1473923499-10904-0002-5947/1366.cpp create mode 100755 public/uploads/tmp/1473923531-10904-0003-1499/1475.cpp create mode 100755 public/uploads/tmp/1473923555-10904-0004-8765/1261.cpp 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 += " "; new_tr += "" + result.file[i].name + ""; new_tr += ""+result.file[i].auth+""; - new_tr += "