creocoder / yii2-flysystem

The Flysystem integration for the Yii framework.
Other
283 stars 76 forks source link

Error while using Azure Storage #20

Closed sabkaraja closed 8 years ago

sabkaraja commented 8 years ago

Hi

When I am uploading a file to the Azure FILE Storage I am getting the following error:

in 
E:\WAMP\www\myweb\_protected\vendor\microsoft\windowsazure\WindowsAzure\Common\Internal\Http\Url.php at line 74 – WindowsAzure\Common\Internal\Validate::isTrue(false, 'Provided URL is invalid.')

E:\WAMP\www\allure\_protected\vendor\microsoft\windowsazure\WindowsAzure\Common\Internal\RestProxy.php at line 122 – WindowsAzure\Common\Internal\Http\Url::__construct('https://cG9rYXJuYXZpb282mGQ=.blo...')

The settings that I have in my config file is:

'filesystem' => [
            'class' => 'creocoder\flysystem\AzureFilesystem',
            'accountName' => 'azure-accname',
            'accountKey' => 'some-long-key-A==',
            'container' => 'azure-container',
],

and finally, the code I am calling to save the file is:

if($file = \yii\web\UploadedFile::getInstance($this, 'attachment'))
{
    $stream = fopen($file->tempName, 'r+');
    Yii::$app->filesystem->writeStream($file->name, $stream);
}

Some additional information that might be helpful

  1. running on yii2 advanced framework
  2. webserver: IIS 8.5 on Windows 2012
  3. PHP 5.4.5
  4. composer used for installation
  5. its a azure file system - the error seems to throw error for blob.xxxxx
sabkaraja commented 8 years ago

I managed to solve it by base decoding the accountKey in the config parameters and

remove base_encode in the Line https://github.com/creocoder/yii2-flysystem/blob/master/src/AzureFilesystem.php#L62