Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function format_size($size) {
- $sizes = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
- if ($size == 0) { return('n/a'); } else {
- return (round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . $sizes[$i]); }
- }
- function getFileSize($url)
- {
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($ch, CURLOPT_HEADER, TRUE);
- curl_setopt($ch, CURLOPT_NOBODY, TRUE);
- $data = curl_exec($ch);
- $size = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
- curl_close($ch);
- return $size;
- }
Add Comment
Please, Sign In to add comment