WordPress HTTP API standardize the HTTP requests to allow using a single function instead of providing different method supports based on web hosting.
Instead of directly using curl or any other method, you can use the WordPress HTTP API.
wp_remote_post allows you to send a HTTP post request, but it doesn’t support sending file over to the URL.
For Posting a file using wp_remote_post, you can use the hack given below, It was originally suggested by David Anderson in WordPress mailing list.
It works perfectly fine, however for bigger file size it might have some issues.
Too bad this puts the whole file into memory.
please give an example of what $req contains