I am uploading an image to a folder name "upload". Then I am changing the name and extension of the image. I am getting the current time and date with default time zone now I am trying to set the image extension to "jpeg" after the getted date and time I was tried but is not given result I put my code here
I suppose when I upload image at that time my file name is "NEWYORK.JPG" But after upload the image I want to change the file name is "9/10/2012/05:31:15.jpeg" from get the current time and date set default time zone.
date_default_timezone_set('Asia/Kolkata'); $imagename = date('d/m/Y-h:i:s', time()); $imagename=basename($imagename,".jpg"); echo $filename = $imagename; $upload = $_FILES['ctgimage']; $target_path = "upload/"; echo $target_path .= $filename . "." . path_info($upload["name"], PATHINFO_EXTENSION); if(move_uploaded_file($upload["tmp_name"],$target_path)) { echo "uploaded successfully"; $cname=$_POST['ctgname']; mysql_query("insert into category(ctg_name,ctgimage) values('$cname','$target_path')"); }