upload_file


Description:

[ Version ( since = "0.8.0" ) ]
public UploadStream upload_file (PicasaWebAlbum? album, PicasaWebFile file_entry, string slug, string content_type, Cancellable? cancellable = null) throws Error

Uploads a file (photo or video) to the given PicasaWeb album, using the metadata from file and the file data written to the resulting UploadStream.

If album is null, the file will be uploaded to the currently-authenticated user's "Drop Box" album. A user must be authenticated to use this function.

If file has already been inserted, a ENTRY_ALREADYSERTED error will be returned.

If no user is authenticated with the service, AUTHENTICATION_REQUIRED will be returned. It is recommended to retry the upload after refreshing the authorization tokens held by the associated Authorizer using refresh_authorization.

The stream returned by this function should be written to using the standard OutputStream methods, asynchronously or synchronously. Once the stream is closed (using close), finish_file_upload should be called on it to parse and return the updated PicasaWebFile for the uploaded file. This must be done, as file_entry isn't updated in-place.

In order to cancel the upload, a Cancellable passed in to cancellable must be cancelled using cancel. Cancelling the individual OutputStream operations on the UploadStream will not cancel the entire upload; merely the write or close operation in question. See the cancellable for more details.

Any upload errors will be thrown by the stream methods, and may come from the ServiceError domain.

Parameters:

this

a PicasaWebService

album

a PicasaWebAlbum into which to insert the file, or null

file_entry

a PicasaWebFile to insert

slug

the filename to give to the uploaded file

content_type

the content type of the uploaded data

cancellable

a Cancellable for the entire upload stream, or null

Returns:

a UploadStream to write the file data to, or null; unref with unref




2022 vala-language.org