【问题标题】:Can't able to create createFileInfos for an Asset using Azure PHP sdk无法使用 Azure PHP sdk 为资产创建 createFileInfos
【发布时间】:2015-04-15 12:47:16
【问题描述】:

我正在尝试为我从现有 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

【问题讨论】:

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


    【解决方案1】:

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

    干杯, 严明飞

    【讨论】:

      猜你喜欢
      • 2015-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多