Upload File
curl --request PUT \
--url https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName} \
--header 'AccessKey: <api-key>' \
--header 'Content-Type: application/octet-stream' \
--data '<string>'import requests
url = "https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}"
payload = "<string>"
headers = {
"AccessKey": "<api-key>",
"Content-Type": "application/octet-stream"
}
response = requests.put(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {AccessKey: '<api-key>', 'Content-Type': 'application/octet-stream'},
body: '<string>'
};
fetch('https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "<string>",
CURLOPT_HTTPHEADER => [
"AccessKey: <api-key>",
"Content-Type: application/octet-stream"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}"
payload := strings.NewReader("<string>")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("AccessKey", "<api-key>")
req.Header.Add("Content-Type", "application/octet-stream")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}")
.header("AccessKey", "<api-key>")
.header("Content-Type", "application/octet-stream")
.body("<string>")
.asString();require 'uri'
require 'net/http'
url = URI("https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["AccessKey"] = '<api-key>'
request["Content-Type"] = 'application/octet-stream'
request.body = "<string>"
response = http.request(request)
puts response.read_bodyManage Files
Upload File
Upload a file to a storage zone based on the URL path. If the directory tree does not exist, it will be created automatically. The file content should be sent as the body of the request without any type of encoding.
PUT
/
{storageZoneName}
/
{path}
/
{fileName}
Upload File
curl --request PUT \
--url https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName} \
--header 'AccessKey: <api-key>' \
--header 'Content-Type: application/octet-stream' \
--data '<string>'import requests
url = "https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}"
payload = "<string>"
headers = {
"AccessKey": "<api-key>",
"Content-Type": "application/octet-stream"
}
response = requests.put(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {AccessKey: '<api-key>', 'Content-Type': 'application/octet-stream'},
body: '<string>'
};
fetch('https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "<string>",
CURLOPT_HTTPHEADER => [
"AccessKey: <api-key>",
"Content-Type: application/octet-stream"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}"
payload := strings.NewReader("<string>")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("AccessKey", "<api-key>")
req.Header.Add("Content-Type", "application/octet-stream")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}")
.header("AccessKey", "<api-key>")
.header("Content-Type", "application/octet-stream")
.body("<string>")
.asString();require 'uri'
require 'net/http'
url = URI("https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["AccessKey"] = '<api-key>'
request["Content-Type"] = 'application/octet-stream'
request.body = "<string>"
response = http.request(request)
puts response.read_bodyAuthorizations
Headers
Path Parameters
Body
application/octet-stream
Raw request body should contain the contents of the file. This should be raw file data without any sort of encoding.
The body is of type file.
Response
The file upload was successful.