Posts

Showing posts with the label Azure Blob Storage

Integrate Laravel with Azure Blob Storage for file upload, listing, downloading, and deleting

Image
To integrate Laravel with Azure Blob Storage for file upload, listing, downloading, and deleting, you can use the Microsoft Azure Storage Blob SDK for PHP or configure Laravel to use Azure Blob Storage as a filesystem driver. Steps to Use Azure Blob Storage in Laravel: 1. Install Required Packages First, install the Azure Blob Storage PHP SDK and Flysystem Azure adapter: composer require microsoft/azure-storage- blob league/flysystem-azure- blob 2. Configure Azure Blob Storage in Laravel Add Azure Blob Storage configuration to your Laravel project. In config/filesystems.php , add a new disk for Azure: 'disks' => [ // Other disks... 'azure' => [ 'driver' => 'azure' , 'endpoint' => env( 'AZURE_ENDPOINT' , 'https://<account_name>.blob.core.windows.net' ), 'name' => env( 'AZURE_STORAGE_ACCOUNT' ), 'key' => env( 'AZURE_...

Azure Blob Storage + Python Flask - File Upload, Download, and Delete Example

Image
To implement file upload, download, and delete functionalities using Azure Blob Storage and Python Flask, follow these steps: 1. Install Required Packages You will need to install flask and azure-storage-blob Python libraries. pip install flask azure- storage - blob 2. Set Up Azure Blob Storage Ensure you have an Azure Storage account and a Blob container. You'll need the connection string and container name for authentication. 3. Create Flask App Here’s a simple example that demonstrates how to implement file upload, download, and delete in Flask using Azure Blob Storage: import os from flask import Flask, request, send_from_directory, jsonify from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient app = Flask(__name__) # Azure Storage connection string and container name AZURE_STORAGE_CONNECTION_STRING = 'your_connection_string_here' CONTAINER_NAME = 'your_container_name_here' # Initialize the BlobServiceClient blob_service_cli...

Azure Blob Storage + .NET - File Upload, Download, List, and Delete Example

Image
To work with Azure Blob Storage in a .NET application for uploading, listing, downloading, and deleting files, follow these steps: 1. Install Required NuGet Package Add the Azure.Storage.Blobs package to your project: dotnet add package Azure .Storage .Blobs 2. Set Up Azure Blob Storage Client Use the BlobServiceClient , BlobContainerClient , and BlobClient classes for interacting with Blob Storage. 3. Code Examples Initialize the Blob Service Client using Azure.Storage. Blobs; // Connection string from Azure portal string connectionString = "YourAzureBlobStorageConnectionString" ; string containerName = "your-container-name" ; // Create a BlobServiceClient BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString); // Get a reference to the container BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient(containerName); Upload a File public async Task UploadFileAsync(string filePath) { string blobName = Path.G...

File Upload, Download, And Delete - Azure Blob Storage + Spring Boot Example

Image
In this section, you will learn how to create  a storage account on Microsoft Azure and create a simple spring boot application to perform different file operations such as upload, download, and delete files from the Azure blob storage. A little bit of Background Azure Blob Storage Azure Blob storage is Microsoft's object storage solution for the cloud. Blob storage is optimized for storing massive amounts of unstructured data. Unstructured data is data that doesn't adhere to a particular data model or definition, such as text or binary data. More Info -  https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction Spring Boot Spring Boot makes it easy to create stand-alone, production-grade Spring-based Applications that you can "just run".  More Info -  https://spring.io/projects/spring-boot Create an Azure Storage Account and blob container using Azure Portal Sign in to Azure portal  https://portal.azure.com/#home  and search for " Sto...