To get the file creation date in PHP, you can use the filectime() function. This function returns the creation time of the file, as a Unix timestamp. This code will output the creation date of the file in the format “Y-m-d H:i:s”, e.g. “2022-01-01 12:00:00”.
<?php
$zipfile = '/home/xxxx/public_html/public/public.zip';
if (file_exists($zipfile)) {
$file_name = pathinfo($zipfile);
$dirName=$file_name['dirname'];
$fileFullName=$file_name['basename'];
$fileExtenstion=$file_name['extension'];
$fileName=$file_name['filename'];
$size = filesize($zipfile);
$units = array( 'B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
$power = $size > 0 ? floor(log($size, 1024)) : 0;
//echo $dirName."<br>".$fileFullName."<br>".$fileExtenstion."<br>".$fileName."<br>".date ("F d Y H:i:s.", filemtime($zipfile));
echo $fileFullName."<br>".date ("F d Y H:i:s.", filemtime($zipfile))."<br>".number_format($size / pow(1024, $power), 2, '.', ',') . ' ' . $units[$power];;
}
?>
Get file size in gb
Discover more from Soa Technology | Aditya Website Development Designing Company
Subscribe to get the latest posts sent to your email.