PHP code example of brbunny / bruploader
1. Go to this page and download the library: Download brbunny/bruploader library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
brbunny / bruploader example snippets
e = new \BrBunny\BrUploader\Base64("uploads", "images");
// $_POST['image'] => Base64 string of the image
if ($_POST && $_POST['image']) {
try {
$upload = $image->upload($_POST['image'], $_POST['name']);
echo "<img src='{$upload}' width='100%'>";
} catch (Exception $e) {
echo "<p>(!) {$e->getMessage()}</p>";
}
}
rBunny\BrUploader\Base64;
// $_GET['path'] => Image path
if ($_GET && $_GET['path']) {
Base64::remove($_GET['path']);
}