Method: Tus::Storage::S3#create_file
- Defined in:
- lib/tus/storage/s3.rb
#create_file(uid, info = {}) ⇒ Object
Initiates multipart upload for the given upload, and stores its information inside the info hash.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/tus/storage/s3.rb', line 34 def create_file(uid, info = {}) tus_info = Tus::Info.new(info) = .dup [:content_type] = tus_info.["content_type"] if filename = tus_info.["filename"] # Aws-sdk-s3 doesn't sign non-ASCII characters correctly, and browsers # will automatically URI-decode filenames. filename = CGI.escape(filename).gsub("+", " ") [:content_disposition] ||= "inline" [:content_disposition] += "; filename=\"#{filename}\"" end multipart_upload = object(uid).initiate_multipart_upload() info["multipart_id"] = multipart_upload.id info["multipart_parts"] = [] multipart_upload end |