Skip to content

Commit e215c78

Browse files
authored
Update README.md
1 parent 4264759 commit e215c78

File tree

1 file changed

+1
-56
lines changed

1 file changed

+1
-56
lines changed

README.md

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -26,62 +26,7 @@ Then add this to the disks section of config/filesystems.php:
2626

2727
## Usage
2828

29-
### Example: Upload a File
30-
31-
Example of how to upload a file to Azure Blob Storage:
32-
33-
```php
34-
use Illuminate\Support\Facades\Storage;
35-
36-
$file = $request->file('file'); // Assuming a file upload from a request
37-
38-
// Generate a unique file name with extension
39-
$fileName = uniqid() . '.' . $file->getClientOriginalExtension();
40-
41-
// Upload the file to Azure Blob Storage
42-
$path = Storage::disk('azure')->putFileAs('', $file, $fileName);
43-
44-
return response()->json([
45-
'message' => 'File uploaded successfully'
46-
]);
47-
```
48-
49-
### Example: Get File URL
50-
51-
#### Permanent URL
52-
53-
To get a public URL (if the blob container is set to allow public access):
54-
55-
```php
56-
use Illuminate\Support\Facades\Storage;
57-
58-
$filePath = 'example-file.txt'; // Relative path of the file in the container
59-
60-
$url = Storage::disk('azure')->url($filePath);
61-
62-
return response()->json([
63-
'file_url' => $url, // Permanent public URL
64-
]);
65-
```
66-
67-
#### Temporary URL
68-
69-
To generate a temporary URL (with an expiration time for secure access):
70-
71-
```php
72-
use Illuminate\Support\Facades\Storage;
73-
74-
$filePath = 'example-file.txt'; // Relative path of the file in the container
75-
76-
$temporaryUrl = Storage::disk('azure')->temporaryUrl(
77-
$filePath,
78-
now()->addMinutes(30) // Set the expiration time, e.g., 30 minutes
79-
);
80-
81-
return response()->json([
82-
'temporary_url' => $temporaryUrl, // Temporary access URL
83-
]);
84-
```
29+
Usage follows Laravel's filesystem conventions. For uploading, retrieving, and managing files, refer to the official Laravel documentation: 📖 [Laravel Filesystem Documentation](https://laravel.com/docs/11.x/filesystem)
8530

8631
## Support
8732

0 commit comments

Comments
 (0)