I have question and answer site and I use redactor
But since I want to monitor uploaded image base on the subject and date. how can I change imagename of redactor uploaded images?
$subject is my variable name of title of topic and use this code
<?php
$dir = '/sitecom/images/';
$_FILES['file']['type'] = strtolower($_FILES['file']['type']);
if ($_FILES['file']['type'] == 'image/png'
|| $_FILES['file']['type'] == 'image/jpg'
|| $_FILES['file']['type'] == 'image/gif'
|| $_FILES['file']['type'] == 'image/jpeg'
|| $_FILES['file']['type'] == 'image/pjpeg')
{
// setting file's mysterious name
$filename = $subject.md5(date('YmdHis')).'.jpg';
$file = $dir.$filename;
// copying
copy($_FILES['file']['tmp_name'], $file);
// displaying file
$array = array(
'filelink' => $sysUrl.'/assets/uploads/r/'.$filename
);
echo stripslashes(json_encode($array));
}
?>