PHP code example of fknussel / image-uploader
1. Go to this page and download the library: Download fknussel/image-uploader 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/ */
fknussel / image-uploader example snippets
try {
$imageUploader = new ImageUploader(UPLOAD_DIR, MD5_HASH_SALT);
$res = $imageUploader->serve($_GET["identifier"]);
var_dump($res);
} catch (Exception $e) {
var_dump($e);
}
try {
$imageUploader = new ImageUploader();
$imageUploader->setPath(UPLOAD_DIR);
$imageUploader->setSalt(MD5_HASH_SALT);
$imageUploader->setMaxFileSize(MAX_FILE_SIZE);
$uid = time() . rand();
$success = $imageUploader->upload($_FILES[INPUT_FIELD_NAME], $uid);
echo json_encode(array("success" => $success));
} catch (Exception $e) {
die($e);
}
php composer.phar install