0

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 example images have the same size but just don't render?

Does anyone have any tips for how to get past this?

Thom Seddon
  • 1,485
  • 2
  • 15
  • 25

1 Answers1

2

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');
kwminnick
  • 46
  • 2
  • Thanks for answering, I found it was an issue with my PHP version/installation, I tried on a different machine and it worked fine! – Thom Seddon Jan 20 '12 at 23:06
  • I came to this post with the same "MisMatchedChecksumException" problem described in the question above. I updated my code to the code shown in this answer and that did the trick for me. I didn't have to make any PHP version/install changes. I'm up and running now. Thx. – John Erck Jun 26 '12 at 22:45