Hi,
I am currently implementing support for the MetaWeblog/MovableType API in my weblog engine. The API is simply a bunch of XML-RPC methods. One method allows the uploading of files (metaWeblog.newMediaObject). In order to send the binary file via XML-RPC the data gets base64 encoded. The xmlrpc library automatically decodes the data. Writing the file to disk looks something like this:
def newMediaObject(blogid, username, password, data)
fileData = data["bits"] # Decoding is handled by xmlrpc automatically
File.open(data["name"], "wb") { |f| f.write(fileData) }
end
The written data, however, is corrupted. Sometimes even some bytes are missing. Uploading plain text files seems to be ok. But uploading arger files such as JPEG files will result in corrupted data. The client I am using is MarsEdit.
Any suggestions?
Regards,
Lars
···
--
"Stil ist die Fähigkeit, komplizierte Dinge einfach zu sagen - nicht umgekehrt." -- Cocteau, Jean