i have a code here that generates resized images but it generates a fixed name $url = 'destination.jpg';
so here is my code instead of generate a fixed name how can i change the image name to random numbers and letters. eg $url = 'wy3vu45.jpg'
if ($_POST) {
if ($_FILES["file"]["error"] > 0) {
$error = $_FILES["file"]["error"];
}
else if (($_FILES["file"]["type"] == "image/gif") ||
($_FILES["file"]["type"] == "image/jpeg") ||
($_FILES["file"]["type"] == "image/png") ||
($_FILES["file"]["type"] == "image/pjpeg")) {
$url = 'destination .jpg';
$filename = compress_image($_FILES["file"]["tmp_name"], $url, 50);
$buffer = file_get_contents($url);
/* Force download dialog... */
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
/* Don't allow caching... */
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
/* Set data type, size and filename */
header("Content-Type: application/octet-stream");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . strlen($buffer));
header("Content-Disposition: attachment; filename=$url");
/* Send our file... */
echo $buffer;
}else {
$error = "Uploaded image should be jpg or gif or png";
}
}