Re: Big file encryption

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi david,

On 7/14/05, david forums <dforums@xxxxxxxxxxx> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux