app/controllers/s3_browser_multipart/uploads_controller.rb
#Create a new upload
#!Max file size is insecure.
#Response in JSON, and include a status
# 
#
Create a new upload
Max file size is insecure.
Response in JSON, and include a status
Create a new upload Max file size is insecure . Response in JSON and include a status
def create
      upload = Upload.new(params)
      if upload.s3_exists?
        Rails.logger.warn "already_exist_s3 #{upload.object_key}"
        render json: {status: "already_exist"}
      else
        upload.save!
        upload_sign = upload.generate_part_upload_signature
        render json: {status: 'upload_ready', 
          secure_random: params[:secureRandom], name: params[:name],
          chunk_size: upload.chunk_size,
          upload: { url: upload_sign.url.to_s, upload_id: upload.id,
            fields: upload_sign.fields, 
            part_prefix: upload.part_prefix
          }}
      end
    end
def create upload = Upload . new ( params ) if upload . s3_exists? Rails . logger . warn "already_exist_s3 #{upload.object_key}" render json : { status : "already_exist" } else upload . save! upload_sign = upload . generate_part_upload_signature render json : { status : 'upload_ready' , secure_random : params [ :secureRandom ] , name : params [ :name ] , chunk_size : upload . chunk_size , upload : { url : upload_sign . url . to_s , upload_id : upload . id , fields : upload_sign . fields , part_prefix : upload . part_prefix } } end end
Create a new upload
Max file size is insecure.
Create a new upload Max file size is insecure .