Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<CURLFile::setPostFilenameCURLStringFile::__construct>
^cURLLast updated: Mon, 26 Oct 2026

The CURLStringFile class

(PHP 8 >= 8.1.0)

Introduction

CURLStringFile makes it possible to upload a file directly from a variable. This is similar to CURLFile, but works with the contents of the file, not filename. This class or CURLFile should be used to upload the contents of the file with CURLOPT_POSTFIELDS.

Class synopsis

class CURLStringFile {
/* Properties */
public string $data;
public string $mime;
/* Methods */
public function __construct(string $data, string $postname, string $mime = "application/octet-stream")
}

Properties

data

The contents to be uploaded.

postname

The name of the file to be used in the upload data.

mime

MIME type of the file (default is application/octet-stream).

Table of Contents


<CURLFile::setPostFilenameCURLStringFile::__construct>
^cURLLast updated: Mon, 26 Oct 2026