Re: PR 1217: Add support for upload files from buffer string in curl extenion

From: Date: Thu, 23 Apr 2015 09:37:01 +0000
Subject: Re: PR 1217: Add support for upload files from buffer string in curl extenion
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-85913@lists.php.net to get a copy of this message
> On 23 Apr 2015, at 11:59, Michael Wallner <mike@php.net> wrote: > > Why not a ctor as in: > > function __construct ($filename, $buffer = null) { > if (isset ($ buffer)) { > // use $ buffer > } else { > // use file contents > } > } > > The file name parameter can be of use anyway for posted file contents from > buffer. Looks good! So, it work like this (+ error handling) function __construct($filename, $buffer = null) { $this->filename = $filename; if (is_null($buffer)) { $this->data = file_get_contents($filename); } else { $this->data = buffer; } } А.

« previous php.internals (#85913) next »