Integrate MultiStorage into your application seamlessly.
Note: Replace YOUR_BASE_URL with your
actual server domain (e.g., https://storage.geekglory.xyz).
POSThttps://storage.geekglory.xyz/{username}/{provider}/{path_to_file}x-api-key, x-api-secretmultipart/form-data with a field named fileaws, azure, gcpGEThttps://storage.geekglory.xyz/{username}/{provider}/{path_to_file}const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
async function uploadFile() {
const url = 'https://storage.geekglory.xyz/myuser/aws/images/photo.png';
const form = new FormData();
form.append('file', fs.createReadStream('./local-photo.png'));
try {
const res = await axios.post(url, form, {
headers: {
...form.getHeaders(),
'x-api-key': 'YOUR_API_KEY',
'x-api-secret': 'YOUR_API_SECRET'
}
});
console.log('Upload Success:', res.data);
} catch (error) {
console.error('Upload Error:', error.response.data);
}
}
const axios = require('axios');
const fs = require('fs');
async function getFile() {
const url = 'https://storage.geekglory.xyz/myuser/aws/images/photo.png';
const res = await axios.get(url, { responseType: 'stream' });
res.data.pipe(fs.createWriteStream('./downloaded-photo.png'));
}
import requests
url = 'https://storage.geekglory.xyz/myuser/aws/images/photo.png'
headers = {
'x-api-key': 'YOUR_API_KEY',
'x-api-secret': 'YOUR_API_SECRET'
}
with open('./local-photo.png', 'rb') as f:
res = requests.post(url, headers=headers, files={'file': f})
print('Upload Success:', res.json())
import requests
url = 'https://storage.geekglory.xyz/myuser/aws/images/photo.png'
res = requests.get(url, stream=True)
with open('./downloaded-photo.png', 'wb') as f:
for chunk in res.iter_content(1024):
f.write(chunk)
<?php
$url = 'https://storage.geekglory.xyz/myuser/aws/images/photo.png';
$headers = ['x-api-key: YOUR_API_KEY', 'x-api-secret: YOUR_API_SECRET'];
$postFields = ['file' => new CURLFile('./local-photo.png')];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
<?php
$url = 'https://storage.geekglory.xyz/myuser/aws/images/photo.png';
$ch = curl_init($url);
$fp = fopen('./downloaded-photo.png', 'wb');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
?>
package main
import (
"bytes"
"io"
"mime/multipart"
"net/http"
"os"
)
func main() {
url := "https://storage.geekglory.xyz/myuser/aws/images/photo.png"
file, _ := os.Open("./local-photo.png")
defer file.Close()
body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
part, _ := writer.CreateFormFile("file", "./local-photo.png")
io.Copy(part, file)
writer.Close()
req, _ := http.NewRequest("POST", url, body)
req.Header.Set("Content-Type", writer.FormDataContentType())
req.Header.Set("x-api-key", "YOUR_API_KEY")
req.Header.Set("x-api-secret", "YOUR_API_SECRET")
client := &http.Client{}
client.Do(req)
}
package main
import (
"io"
"net/http"
"os"
)
func main() {
url := "https://storage.geekglory.xyz/myuser/aws/images/photo.png"
resp, _ := http.Get(url)
defer resp.Body.Close()
out, _ := os.Create("./downloaded-photo.png")
defer out.Close()
io.Copy(out, resp.Body)
}
curl -X POST https://storage.geekglory.xyz/myuser/aws/images/photo.png \
-H "x-api-key: YOUR_API_KEY" \
-H "x-api-secret: YOUR_API_SECRET" \
-F "file=@./local-photo.png"
curl -O https://storage.geekglory.xyz/myuser/aws/images/photo.png