ruby on rails - Permission denied @ sys_fail2 - (D:/RoR/projects/grp/public/uploads/ -
i trying rename upload image
permission denied @ sys_fail2 - (d:/ror/projects/grp/public/uploads/gallery/test.jpg, d:/ror/projects/grp/public/uploads/gallery/qinsnvzicc20160509132021.jpg)
my code :
photo = params[:gallery][:gal_img] name = photo.original_filename directory = "#{rails.root}/public/uploads/gallery/" path = file.join(directory, name) uniq_name = (0...10).map { (65 + rand(26)).chr }.join time_footprint = time.now.to_formatted_s(:number) file.open(path, "wb") |file| new_file_name = uniq_name + time_footprint + file.extname(file) file.write(photo.read) @uniq_path = file.join(directory, new_file_name) file.rename(file, @uniq_path) end
i have checked , giving privilege
in ruby directory.
please let me know why getting permission denied
error?
Comments
Post a Comment