1. Go to this page and download the library: Download ijin82/flysystem-azure 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/ */
ijin82 / flysystem-azure example snippets
public function someUploadFuncName(Request $request)
{
$file = $request->file('file_name_from_request');
// .. file name logic
// .. file folder logic
$file->storeAs($fileFolder, $fileName, [
'disk' => 'my_azure_disk1'
]);
// save file name logic
// to create file URL by name later
// maybe you want to save file name and folder separated
$fileNameToSave = $folderName . '/' . $diskFileName;
// .. save file name to DB or etc.
}
public function someDeleteFuncName($id)
{
$file = SomeFileModel::findOrFail($id);
Storage::disk('my_azure_disk1')->delete($file->name);
$file->delete();
// go back or etc..
}