I have a working signature form which uploads the resulting jpeg file to server. Within the PHP processing there is also a unique ID which I would like to append to the filename so that it can be unique as currently its uploading with a generic name as you can see below, how would I go about this i.e. so that the $id is used as the filename reference?
<?php
$id=$_GET['id'];
$signature = $_POST['signature'];
$signature = str_replace('data:image/png;base64,', '', $signature);
$signature = str_replace(' ', '+', $signature);
$file = "uploads/uploaded_signature.png";
$success = file_put_contents($file, base64_decode($signature));
print $success ? $file : 'problem saving.';
?>
Signatures can be classed as sensitive information, so storing them in the upload directory may not be an appropriate solution.
As for setting the filename of those images, why not just have the filename just be the ID?
This image will then be saved to
../uploaded_signature/{$ID}.png.