Check Filesize PHP script

SPONSORED LINKS

    Specification

  • Version:
  • File size: 0 KB
  • File name: view.php?id=7
  • Last update:
  • Platform: Windows / Linux / BSD
  • Language: PHP
  • Price:Freeware
  • Company: ScriptsForYou (View more)

Check Filesize script description:




Publisher review:
Check Filesize - Gets the filesize of a file that is not located on your server. Check Filesize - Gets the filesize of a file that is not located on your server.

php $url = "http://www.your.url/file.zip"; $size = getRemoteSize($url); // filesize in bytes echo (round(abs($size)/1024)).'' kb''; ?> /** * Gets the filesize of a remotely located file * * @access public * @param string $url URL to file * @return integer filesize in bytes */ function getRemoteSize($url) { $parsedUrl = parse_url($url); $host = $parsedUrl[''host'']; $path = $parsedUrl[''path'']; $ourhead = ''''; $fp = fsockopen($host, 80, $errno, $errstr, 20); if(!$fp) { exit("$errstr ($errno) "); } else { $out = "HEAD $url HTTP/1.1 "; $out .= "HOST: dummy "; $out .= "Connection: close "; fputs($fp,$out); while (!feof($fp)) { $ourhead = sprintf("%s%s", $ourhead, fgets ($fp,128)); } } fclose($fp); $split1 = explode("content-length: ", strtolower($ourhead)); if(!@$split1[1]) exit(''Error: No content length''); $split2 = explode(" ", $split1[1]); $size = (int) $split2[0]; // size in bytes return $size; } ?> Example usage: include_once(''Sd_FileSize.class.php''); echo Sd_FileSize::getSizeHuman(''file.zip'') echo Sd_FileSize::getSizeHuman(''directory/test''); echo Sd_FileSize::getSizeHuman(''http://www.example.com/file.zip''); ?>
Check Filesize is a PHP script for Snippets scripts design by ScriptsForYou. It runs on following operating system: Windows / Linux / BSD.

Operating system:
Windows / Linux / BSD

Latest script and internet news

222

222

22

Posted on: 18 Jul 2023 22:27 by A. Brown

111

111

111

Posted on: 18 Jul 2023 22:24 by A. Brown

The permanently active Push system offered by the new Google Chrome 42

The permanently active Push system offered by the new Google Chrome 42

Hacked By !Sc-sT

Posted on: 17 Mar 2015 07:57 by A. Brown

SPREAD THE WORD

User Rating


Rating: 2.2 out of 5
Based on 13 ratings. 13 user reviews.

  • Currently 2.15 out of 5
  • 1
  • 2
  • 3
  • 4
  • 5