无法使用Azure PHP sdk为资产创建createFileInfos

时间:2015-02-14 15:35:50

标签: php azure azure-storage azure-storage-blobs azure-media-services

我尝试为从现有blob复制的资产创建createFileInfos。我可以创建资产并将blob复制到新创建的资产。但我试图为这个资产创建createFileInfos个文件,但它没有创建。我正在使用PHP sdk。我在这里错过了什么吗?

示例代码:

$asset = new Asset(Asset::OPTIONS_NONE);//Asset creation
$assetname = 'myasset';
$asset->setName($assetname);
$asset = $this->_mediaService->createAsset($asset);

$access = new AccessPolicy($assetPolicyName);//Access Policy
$access->setDurationInMinutes(6000);
$access->setPermissions(AccessPolicy::PERMISSIONS_WRITE);
$access = $this->_mediaService->createAccessPolicy($access);

$locator = new Locator($asset, $access, Locator::TYPE_SAS);//Locator
$locator->setStartTime(new \DateTime('now -5 minutes'));
$locator = $this->_mediaService->createLocator($locator);

$asset = $this->getAssetByName($assetname);
$destinationContainer = <newly created assset container>;
$destinationBlob = <filename>;
$sourceContainer = <my source blob>;
$sourceBlob = <source filename>;
$blobRestProxy->copyBlob($destinationContainer, $destinationBlob, $sourceContainer, $sourceBlob); // Copying Blob
$this->_mediaService->createFileInfos($asset); // trying to create asset info files

1 个答案:

答案 0 :(得分:0)

我相信这可能是由于PHP SDK中使用的旧版Blob REST API。 createFileInfos的方式是正确的。您可以在我们的开发分支中尝试此修复:https://github.com/Azure/azure-sdk-for-php/commit/972e09c74308411602027280ededb3048b1e2fc4,看看您是否可以使上传工作?

干杯, 严明飞