jarell wrote:

I'm trying to write a stream wrapper that will be used to let users download a file only once.
I'm confused as to what function definined on the php definition page for stream_wrapper_register I need to use. I'm guessing that stream_eof will be important.
What about stream_close?

You'll need most of them, more than likely. stream_open, stream_read, stream_close, stream_eof at least.


stream_wrapper_register('onetime','onetime');

class onetime
{
  var $fp = FALSE;

  stream_open($path, $mode, $options, $opened_path)
  {
    //Perform check for only one download
    if($this->fp = fopen($path,$mode))
    { return TRUE; }
    else
    { return FALSE; }
  }

  stream_read($bytes)
  { return fread($this->fp,$bytes); }

  stream_eof()
  { return feof($this->fp); }

  stream_close()
  { return fclose($this->fp); }
}

--

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

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



Reply via email to