Source Code:
(back to article)
<?php // URL of the file $url = "https://workupload.com/start/c2kh9NB"; // Use the get_headers() function to retrieve the headers of the file $headers = get_headers($url, 1); // Check if the "Content-Length" header is present in the response if (isset($headers["Content-Length"])) { // Store the value of the "Content-Length" header in the $filesize variable $filesize = $headers["Content-Length"]; // Output the size of the file echo "The file size is: " . $filesize . " bytes"; } else { // If the "Content-Length" header is not present, output an error message echo "Unable to retrieve the size of the file."; } ?>
Result:
Report an issue