Below is the given code. I want to renamen the file before uploading. On submitting it is showing error: Undefined index.
if($_FILES['FPScreenShot']['name']==true)
{
$SPPic = ($_FILES['FPScreenShot']['name']);
$curTime = time();
$NewPriorPic = "prior";
$NewPriorPic = $NewPriorPic.$SGeiNo;
$NewPriorPic = $NewPriorPic.$SSurgDt;
$NewPriorPic = $NewPriorPic.$curTime;
move_uploaded_file($_FILES['FPScreenShot']['tmp_name'] , "upload_pictures/".$_FILES['$NewPriorPic']['name']);
}
else
{
$SPPic = "NIL";
}
Solved. For future reference, if anyone needed.
if($_FILES['FPScreenShot']['name']==true)
{
$SPPic = ($_FILES['FPScreenShot']['name']);
$ext = pathinfo($SPPic, PATHINFO_EXTENSION);
$curTime = time();
$NewPriorPic = "prior";
$NewPriorPic = $NewPriorPic.$SGeiNo;
$NewPriorPic = $NewPriorPic.$SSurgDt;
$NewPriorPic = $NewPriorPic.$curTime;
$NewPriorPic = $NewPriorPic.".".$ext;
$location = "upload_pictures/";
move_uploaded_file($_FILES['FPScreenShot']['tmp_name'], $location.$NewPriorPic);
}