diff --git a/storage/BlockBlobExample.php b/storage/BlockBlobExample.php index 90bf765..3f2947b 100644 --- a/storage/BlockBlobExample.php +++ b/storage/BlockBlobExample.php @@ -125,7 +125,7 @@ function createContainerIfNotExists($blobRestProxy) $counter = 1; $blockIds = array(); - while (!feof($handle)) + while ($data = fread($handle, BLOCKSIZE)) { $blockId = str_pad($counter, PADLENGTH, "0", STR_PAD_LEFT); echo "Processing block $blockId.\n"; @@ -135,8 +135,6 @@ function createContainerIfNotExists($blobRestProxy) $block->setType("Uncommitted"); array_push($blockIds, $block); - $data = fread($handle, BLOCKSIZE); - // Upload the block. $blobRestProxy->createBlobBlock(CONTAINERNAME, BLOCKBLOBNAME, base64_encode($blockId), $data); $counter++; @@ -167,4 +165,4 @@ function createContainerIfNotExists($blobRestProxy) echo "$code: $error_message"; } -?> \ No newline at end of file +?>