A new scriptable interface in Gears 0.5.16.0 could help here.
// creates a new empty blobBuilder
var builder = google.gears.factory.create('beta.blobbuilder');
interface BlobBuilder {
append(String str); // appends the string data, utf8 encoded
append(Blob blob); // appends the blob verbatim
Blob getAsBlob(); // returns a blob containing all data appended to
the builder since construction
};
By using a blobBuilder, you can compose a multipart/form-data encoded
blob that can be uploaded via HttpRequest.send.