Module: Reactor::StreamingUpload::Base

Defined in:
lib/reactor/streaming_upload.rb

Instance Method Summary collapse

Instance Method Details

#upload(data_or_io, extension) ⇒ Object

Uploads a file/string into a CM. Requires call to save afterwards(!) NOTE: behavior of this method is slightly different, than the traditional method: this method opens a TCP connection to the CM, transfers the data and stores the reference (so called streaming ticket). You still need to call save! afterwards.

Parameters:

  • data_or_io (String, IO)
  • extension (String)

    file extension

Raises:

  • (Reactor::UploadError)

    raised when CM does not respond with streaming ticket (i.e. has not accepted the file)

  • (Timeout::Error)

    if upload to CM takes more than: 60 seconds for IO streaming IO or 30 seconds for memory



17
18
19
20
# File 'lib/reactor/streaming_upload.rb', line 17

def upload(data_or_io, extension)
  self.uploaded = true
  Reactor::Tools::Uploader.new(crul_obj).upload(data_or_io, extension)
end