Getting error during uploading image in azure blob storage

Jun 11, 2010 at 11:46 AM
Edited Jun 13, 2010 at 10:31 AM

Hi Friends,

I tried to upload an image in to my blob storage.  I tried various way to upload image. But everytime I am getting the same error.

This is my PHP code.

First way:

header('Content-type: text/html');

include ("C://xampp/htdocs/azure/Microsoft/WindowsAzure/Storage/Blob.php");

// Connect to Windows Azure cloud storage
$sto = '';
$acc = 'xxxxxxxxxxxx';

// primary key
$key = 'xxxxxxxxxxxxxxxxxxxxxx';

//secondary key

//$key = 'xxxxxxxxxxxxxxxxxxxxxx';

$client = new Microsoft_WindowsAzure_Storage_Blob($sto, $acc,$key);

//echo " after client creation :  " . (bool)$client;

$localpath = 'C:\xampp\htdocs\azure\Image\Winter.jpg';

$result = $client->putBlob('thumbnail', 'Winter.jpg', $localpath);

//$result = $client->listContainers();
//$count = count( $result );
//echo "Existing containers: " . $count;


Second Way:


include ('C://xampp/htdocs/azure/Microsoft/WindowsAzure/Storage/Blob.php');

$sto = '';
$acc = 'xxxxxxxxxxxxxxxxxxx';

//primary key
$key = 'xxxxxxxxxxxxxxxxxxxxxx';

// secondary key

//$key = 'xxxxxxxxxxxxxxxxxxxxxx';

$storageClient = new Microsoft_WindowsAzure_Storage_Blob($sto, $acc,'');

$sharedAccessUrl = $storageClient ->generateSharedAccessUrl('testcontainer','','c', 'w');
echo $sharedAccessUrl ;

$storageClient->setCredentials(new Microsoft_WindowsAzure_SharedAccessSignatureCredentials());


$storageClient->putBlob('testcontainer', 'NewBlob.jpg','C:\xampp\htdocs\azure\Image\Winter.jpg');


Everytime while I access PutBlob() or GetBlod() or  listContainers() method . I get the following error. 

 My error is " Fatal error: Uncaught exception 'Microsoft_Http_Transport_Exception' with message 'cURL error occured during request for 6 - Could not resolve host:; No data record of requested type' in C:\XAmpp\htdocs\azure\Microsoft\Http\Transport\Curl.php:173 Stack trace: #0 C:\XAmpp\htdocs\azure\Microsoft\WindowsAzure\RetryPolicy\NoRetry.php(63): Microsoft_Http_Transport_Curl->request('GET', 'http://zentestb...', Array, Array, NULL) #1 C:\XAmpp\htdocs\azure\Microsoft\WindowsAzure\Storage.php(322): Microsoft_WindowsAzure_RetryPolicy_NoRetry->execute(Array, Array) #2 C:\XAmpp\htdocs\azure\Microsoft\WindowsAzure\Storage\Blob.php(957): Microsoft_WindowsAzure_Storage->performRequest(Array, Array) #3 C:\XAmpp\htdocs\azure\Test.php(53): Microsoft_WindowsAzure_Storage_Blob->getBlob('testcontainer/D...', '', 'GET', Array, false, NULL, 'b', 'r') #4 {main} thrown in C:\XAmpp\htdocs\azure\Microsoft\Http\Transport\Curl.php on line 173 ".

I am not getting what mistake I have done and dont understand how to resolve this error.

Initially I was getting another type of curl error. So I followed all the steps from the net to enable curl. Later on that error was resolved.

Some one please look into this and please let me know the solution what could be the possibilities. Is my code not correct or do I need to change any environment setting before executing this code ? I am using XAMPP.


Thanks And Regards,

Chiranjibi Das