bug #46439 - better handling of CURL file uploads

Implementation of CurlFile RFC - please see https://wiki.php.net/rfc/curl-file-upload. Can be amended following discussion on the list.