lib/chatrix/api/media.rb
def upload(type, path)
        File.open(path, 'r') do |file|
          make_request(
            :post, '/upload',
            headers: {
              'Content-Type' => type, 'Content-Length' => file.size.to_s,
              'Transfer-Encoding' => 'chunked'
            },
            content: file, base: @media_uri
          )['content_uri']
        end
      end
# Uploads a new media file to the server.
# @param type [String] The `Content-Type` of the media being uploaded.
# @param path [String] Path to a file to upload.
# @return [String] The MXC URL for the uploaded object (`mxc://...`).
Uploads a new media file to the server.
Uploads a new media file to the server .
def upload(type, path)
        File.open(path, 'r') do |file|
          make_request(
            :post, '/upload',
            headers: {
              'Content-Type' => type, 'Content-Length' => file.size.to_s,
              'Transfer-Encoding' => 'chunked'
            },
            content: file, base: @media_uri
          )['content_uri']
        end
      end
def upload ( type , path ) File . open ( path , 'r' ) do | file | make_request ( :post , '/upload' , headers : { 'Content-Type' => type , 'Content-Length' => file . size . to_s , 'Transfer-Encoding' => 'chunked' } , content : file , base : @media_uri ) [ 'content_uri' ] end end
Uploads a new media file to the server.
Uploads a new media file to the server .
The MXC URL for the uploaded object (`mxc://...`).
The MXC URL for the uploaded object ( ` mxc : // ... ` ) .
String
type
The `Content-Type` of the media being uploaded.
The ` Content - Type ` of the media being uploaded .
path
Path to a file to upload.
Path to a file to upload .