Closed ronnieschuurbiers closed 8 years ago
Try this instead:
$container->saveMetadata(['Access-Control-Allow-Origin' => 'foo.com'], false);
Note the second arg.
That didn't work either, but you got me on the right track so thanks anyway :) Apparently this works:
$result = $container->saveMetadata(array( 'X-Container-Meta-Access-Control-Allow-Origin' => '*', ), false);
Glad you sorted it out!
I'm trying to upload a file from a website directly to Rackspace File Cloud with JavaScript so I'm not using my own servers bandwidth. I'm using this JavaScript code (https://developer.rackspace.com/blog/upload-files-directly-to-rackspace-cloud-files-from-the-browser/) with this PHP code (https://gist.github.com/jpilcher/923b823a9c6816250c56). In the browser console it says CORS-header ‘Access-Control-Allow-Origin’ is missing. The saveMetadata doesn't seem to do anything. If I look at the headers of the response of the OPTIONS request, indeed the header is missing. How can I get this to work?
I also tried setMetadata, on both the container and the object, but that doesn't work either.