File manager - Edit - /home/cipherteam/htdocs/cipherteam.in/admin3/uploadimg.php
Back
<?php $message = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['fileToUpload'])) { $storageZoneName = 'smipo'; $apiKey = '4fed9253-cd11-4cd3-bd6d1976382a-cd32-485c'; // Storage Zone Password $uploadFolder = '/uploads/'; // Change if you want a different folder on BunnyCDN $file = $_FILES['fileToUpload']['tmp_name']; $filename = basename($_FILES['fileToUpload']['name']); $remotePath = $uploadFolder . $filename; $url = "https://storage.bunnycdn.com/$storageZoneName/$remotePath"; $fp = fopen($file, 'rb'); $ch = curl_init($url); curl_setopt($ch, CURLOPT_USERPWD, "$apiKey:"); curl_setopt($ch, CURLOPT_PUT, true); curl_setopt($ch, CURLOPT_INFILE, $fp); curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $error = curl_error($ch); curl_close($ch); fclose($fp); if ($httpCode === 201) { $message = "<div class='alert alert-success'>✅ File <strong>$filename</strong> uploaded successfully to <strong>smipo/uploads/</strong>.</div>"; } else { $message = "<div class='alert alert-danger'>❌ Upload failed (HTTP $httpCode)<br><strong>Error:</strong> $error</div>"; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Upload to BunnyCDN - smipo</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> </head> <body class="bg-light"> <div class="container mt-5"> <div class="card shadow-sm p-4"> <h2 class="mb-4">📤 Upload File to BunnyCDN <span class="text-muted">(Zone: <strong>smipo</strong>)</span></h2> <?= $message ?> <form method="POST" enctype="multipart/form-data"> <div class="mb-3"> <label for="fileToUpload" class="form-label">Choose File</label> <input class="form-control" type="file" name="fileToUpload" id="fileToUpload" required> </div> <button type="submit" class="btn btn-primary">Upload</button> </form> </div> </div> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.2.9 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings