Skip to content

Instantly share code, notes, and snippets.

View mukundsojitra5464's full-sized avatar

Mukund Sojitra mukundsojitra5464

View GitHub Profile
@mukundsojitra5464
mukundsojitra5464 / __upload_file.md
Created February 14, 2023 06:21 — forked from maxivak/__upload_file.md
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");