Hello i have that code to change an uploaded file name on display name and disk name. Its working really good.
//EVRAK
$fileArray2 = my_json_decode($values["Evrak"]);
// rename each file. In this example - convert to lowercase.
for($i = 0; $i < count($fileArray2); $i++)
{
$fileArray2[$i]["usrName"] = "".$values["Davaci"]." ".$values["evrak_nedeni"].".pdf";
}
// update values of the field that stores file names
$values["Evrak"] = my_json_encode($fileArray2);
// get information about uploaded files
$fileArray = my_json_decode($values["Evrak"]);
// rename files
for($i = 0; $i < count($fileArray); $i++)
{
$fileName = $fileArray[$i]["name"];
$newFileName = "files/".$values["Davaci"]." ".$values["evrak_nedeni"].".pdf";
rename($fileName, getabspath($newFileName));
$fileArray[$i]["name"] = $newFileName;
}
// update values of the field that stores file names
$values["Evrak"] = my_json_encode($fileArray);
return true;
But i have another upload field in that table. field name is "kargo_fisi". It has the same "View As/Edit As" settings and same sql options.
It also needs to change the uploaded files display and disk name but a little bit different. In needs to rename
$fileArray2[$i]["usrName"] = "".$values["Davaci"]." ".$values["istenme_tarihi"].".pdf";
If i add the same code above after "return true;" it displays nothing as uploaded. And dont rename it on disk just uploads the file with same name.
How can i make it done? Thanks alot for your help!