Class: Bongo::FilesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Bongo::FilesController
- Defined in:
- app/controllers/bongo/files_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/bongo/files_controller.rb', line 11 def create extension = File.extname(params[:file].original_filename) s3 = Aws::S3::Resource.new obj = s3.bucket(ENV["AWS_S3_BUCKET"]).object(SecureRandom.uuid + extension) obj.upload_file(params[:file]) respond_to do |format| format.json { render json: obj.public_url } end end |