Creates a new resumable UploadStream, allowing a file to be uploaded from a GData service using standard OutputStream API.
The upload will use GData's resumable upload API, so should be more reliable than a normal upload (especially if the file is large). See the <ulink type="http" url="http://code.google.com/apis/gdata/docs/resumable_upload.html">GData documentation on resumable uploads </ulink> for more information.
The HTTP method to use should be specified in method, and will typically be either
soup_method_post (for insertions) or soup_method_put (for updates), according to the server and
the upload_uri.
If entry is specified, it will be attached to the upload as the entry to which the file being uploaded belongs. Otherwise,
just the file written to the stream will be uploaded, and given a default entry as determined by the server.
slug, content_type and content_length must be specified before the upload begins, as they describe
the file being streamed. slug is the filename given to the file, which will typically be stored on the server and made
available when downloading the file again. content_type must be the correct content type for the file, and should be in the
service's list of acceptable content types. content_length must be the size of the file being uploaded (not including the XML
for any associated Entry) in bytes. Zero is accepted if a metadata-only upload is being
performed.
As well as the standard GIO errors, calls to the OutputStream API on a UploadStream can also return any relevant specific error from ServiceError, or gdata_service_error_protocol_error in the general case.
If a Cancellable is provided in cancellable, the upload
operation may be cancelled at any time from another thread using cancel
. In this case, any ongoing network activity will be stopped, and any pending or future calls to
OutputStream API on the
UploadStream will return g_io_error_cancelled. Note
that the Cancellable objects which can be passed to individual
OutputStream operations will not cancel the upload operation proper
if cancelled — they will merely cancel that API call. The only way to cancel the upload operation completely is using this
cancellable.
Note that network communication won't begin until the first call to write on the UploadStream.
| service |
a Service |
| domain |
the AuthorizationDomain to authorize the upload, or null |
| method |
the HTTP method to use |
| upload_uri |
the URI to upload |
| entry |
the entry to upload as metadata, or null |
| slug |
the file's slug (filename) |
| content_type |
the content type of the file being uploaded |
| content_length |
the size (in bytes) of the file being uploaded |
| cancellable |
a Cancellable for the entire upload stream, or null |
|
a new OutputStream, or null ; unref with unref |