Skip to content

Instantly share code, notes, and snippets.


Harrison Henri dos Santos Nascimento harrisonhenri

  • Compass UOL
  • Bahia, Brazil
View GitHub Profile
komyg /
Last active December 28, 2020 22:33
Kubernetes Cheat Sheet
maxivak /
Last active May 20, 2023 18:59
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");