Skip to content

Instantly share code, notes, and snippets.


Harrison Henri dos Santos Nascimento harrisonhenri

  • Alelo
  • Bahia, Brazil
View GitHub Profile
komyg /
Last active Dec 28, 2020
Kubernetes Cheat Sheet
maxivak /
Last active Aug 4, 2022
PHP upload file with curl (multipart/form-data)

We want to upload file to a server with POST HTTP request. We will use curl functions.

// data fields for POST request
$fields = array("f1"=>"value1", "another_field2"=>"anothervalue");

// files to upload
$filenames = array("/tmp/1.jpg", "/tmp/2.png");