Re: Big file encryption

From: Date: Thu, 14 Jul 2005 12:25:48 +0000
Subject: Re: Big file encryption
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-218674@lists.php.net to get a copy of this message
hi david, On 7/14/05, david forums <dforums@vieonet.com> wrote: > So I need to know a way to be able to encrypt large file. function readfile_chunked ($filename) { $chunksize = 1*(1024*1024); // it reads 1 mb per chunck. adjust this if u need. $buffer = ''; $handle = fopen($filename, 'rb'); if ($handle === false) { return false; } while (!feof($handle)) { $buffer = fread( $handle, $chunksize ); // do whatever with the chuck you read. // you can encrypt it and write all the chunks to the same file // (open a file for writing before the loop) } return fclose( $handle ); } -ahmed

« previous php.general (#218674) next »