Ateik
Ateik

Reputation: 2586

Write text file to Blob in Azure using PHP

I'm trying to write a text file to the blob. I know i have to create a container and a blob. I need to write something like this:

$text = 'some text';
$myFile = "file.txt";
$fh = fopen($myFile, 'w') or die("can't open file c");
fwrite($fh, $json);
fclose($fh);

The question is I want to write this php script but using blob ( we dont have access to the file the system ) how can I do that?

Upvotes: 0

Views: 1152

Answers (1)

Sandrino Di Mattia
Sandrino Di Mattia

Reputation: 24895

After saving the file to disk you'll need to upload it to a container:

_storageClient->putBlob('mycontainer', 'file.txt', 'file.txt');

You can do this by using the Windows Azure PHP SDK. Follow this tutorial for more information: Put a Blob in a Blob Container

Upvotes: 1

Related Questions