Re: Bad File Mode?

From: Date: Fri, 29 Nov 2002 21:46:57 +0000
Subject: Re: Bad File Mode?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-126498@lists.php.net to get a copy of this message
At 11/28/2002 01:51 PM, Ernest E Vogelsinger wrote:
<?
        $data = "mtype=XMLDOC&outfile=true";
        $dataFile =
"http://www.healthtvchannel.org/courses/pay/data/test.xml";
        $fileSize = filesize($dataFile);
Ah. It is a local file, I was just using an absolute reference for it.
However you do not need to know the size of the file to read it - simply do it in chunks:
        $dataFile = "http://www.healthtvchannel.org/courses/pay/data/test.xml";
        $fp = fopen($dataFile, "rb");
         $strFile = null;
         while ($chunk = fread($fp, 524288))  // 512 kB chunks modify as needed
              $strFile .= $chunk;
        fclose($fp);
Thanks. I'll definitely give that a try. -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: skeller@healthtvchannel.org Web: www.healthtvchannel.org

« previous php.general (#126498) next »