This is a simple example to do a "multipart/form-data" POST request in PHP without any fancy library.
You need to download all files into a folder. Then create an empty folder "uploads" in the same folder to store the uploaded files.
To serve the handle_upload.php file properly, run this command in the folder:
php -S 127.0.0.1:8080 -t .
The file handle_upload.php
should be accessible at "http://localhost:8080/handle_upload.php".
When all the aboves are ready, run this:
php upload.php ./test_data.txt
You can try other files than "test_data.txt" to see the upload result.
The uploaded file should be available in the "./uploads" folder you created.
Inspired by the Stackoverflow question here.