i tried use softlayer object storage api-client. softlayer-object-storage-php
my goal search file name, , see if file exists.
singlebyte filename(ex. a.jpg) correct result. multibyte filename(日本語.jpg) not correct result.
my container photo
, no subdirectory.
sjc01/photo/a.jpg sjc01/photo/日本語.jpg sjc01/photo/multibyte_filename.jpg sjc01/photo/anytime space.jpg ...
below code
<?php include('/includes/lib/objectstorage/util.php'); $tokenstore = objectstorage_tokenstore::factory('file', array('ttl' => 3600, 'path' => '/tmp/objectstorage')); #give write permission in /tmp/objectstorage objectstorage::settokenstore($tokenstore); $host = 'https://sjc01.objectstorage.softlayer.net/auth/v1.0'; $username='slxxxxxxxxxxx'; $password='xxxxxxxxxxxxx'; $options = array('adapter' => objectstorage_http_client::socket, 'timeout' => 10); $objectstorage = new objectstorage($host, $username, $password, $options); $containerlist = $objectstorage->with('photo') ->setcontext('search') ->setfilter('type', 'object') ->setfilter('q.name', "multibytefilename.jpg") ->setmime('json') ->get(); var_dump($containerlist);
the result objectcount 100 incorrect. hope objectcount 1.
end of part of return value.
["context":protected]=> string(6) "search" ["containercount":protected]=> int(0) ["objectcount":protected]=> int(100)
i need status exists.
has idea or correct method?
thank you.
i think query returning objects .jpg. try this:
$containerlist = $objectstorage->with('test') ->setcontext('search') ->setfilter('type', 'object') ->setfilter('q.name', "a.jpg") ->setmime('json') ->get(); var_dump($containerlist);
if not wrong, need specify property (in case name)
here more information fields can use in query search. http://sldn.softlayer.com/article/api-operations-search-services
i hope helps you.
Comments
Post a Comment