PHP code example of lnc / azure-file-service
1. Go to this page and download the library: Download lnc/azure-file-service library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lnc / azure-file-service example snippets
indowsFileService\Common\ServicesBuilder;
use WindowsFileService\Facade;
$accountName = '';
$accountKey = '';
$isSecure = true;
$connectionString = sprintf(
'DefaultEndpointsProtocol=%s;AccountName=%s;AccountKey=%s',
$isSecure
? 'https'
: 'http',
$accountName,
$accountKey
);
### USING FACADE
$result = new Facade( $connectionString );
$result->uploadFile(
'test',
'test',
'test.dat',
'/home/test.dat'
);
### DIRECTLY
$fileRestProxy = ServicesBuilder::getInstance()
->createFileService( $connectionString );
$result = $fileRestProxy->createShare(
'test'
);
$result = $fileRestProxy->createDirectory(
'test',
'test'
);
$result = $fileRestProxy->createFile(
'test',
'test',
'test.txt',
4
);
$result = $fileRestProxy->createFileContents(
'test',
'test',
'test.txt',
'test'
);
OR
$result = $fileRestProxy->createFileRange(
'test',
'test',
'test.txt',
new \WindowsFileService\File\Models\FileRange( 0, 3 ),
'test'
);