I am having an issue uploading to Rackspace Cloudfiles.
I am able to upload anything that is text based (text/html, text/plain etc) but anything else I try fails with the MisMatchedChecksumException which, as I understand it, means the md5_file() on my end doesn't match their computation at their end?
If I don't set the etag (and so this check is not made) the file is uploaded but not correctly, so for exam开发者_如何学Pythonple images have the same size but just don't render?
Does anyone have any tips for how to get past this?
The following code works fine for me, can you show a snippet that doesn't work?
$fname = basename('test.jpg');
$md5 = md5_file($fname);
$container = $conn->get_container('my_container');
$o2 = $container->create_object($fname);
$o2->content_type = "image/jpeg";
$o2->set_etag($md5);
$result = $o2->load_from_filename($fname);
assert('!is_null($result)');
assert('$o2->getETag() == $md5');
精彩评论