With our global CDN, you can upload your files from anywhere in the world, enjoying exceptional speed and reliability. Our cutting-edge technology ensures your files are delivered swiftly and securely. Please note that the maximum file size limit for uploads is 100 MB per file, allowing for efficient management and optimal performance of our services.
| 1 | # Upload file ke Guardian Cloud |
| 2 | curl -X POST "https://your-domain/upload" \ |
| 3 | -F "file=@image.png" |
| 4 | |
| 5 | # Response: |
| 6 | { "status": true, |
| 7 | "data": { "url": "https://your-domain/file/ab12cd34.png" } } |
| 1 | import axios from 'axios'; |
| 2 | import fs from 'fs'; |
| 3 | import FormData from 'form-data'; |
| 4 | |
| 5 | async function uploadToCDN(filePath) { |
| 6 | const formData = new FormData(); |
| 7 | formData.append('file', fs.createReadStream(filePath)); |
| 8 | |
| 9 | const response = await axios.post('https://your-domain/upload', formData, { |
| 10 | headers: { ...formData.getHeaders() } |
| 11 | }); |
| 12 | return response.data.data.url; // ".../file/ab12cd34.png" |
| 13 | } |
| 14 | |
| 15 | // Example usage: |
| 16 | uploadToCDN('/path/to/your/file.jpg'); |
| 1 | import requests |
| 2 | |
| 3 | def upload_to_cdn(file_path): |
| 4 | with open(file_path, 'rb') as f: |
| 5 | files = { 'file': f } |
| 6 | resp = requests.post('https://your-domain/upload', files=files) |
| 7 | return resp.json()['data']['url'] |
| 8 | |
| 9 | # Example usage: |
| 10 | print(upload_to_cdn('/path/to/your/file.jpg')) |
If you like Guardian Cloud and want to support further development, consider donating below!