is it possible to send a file to a server at the same way like this:
$file = 'myfile.txt';
or
$file = file_get_contents(./myfile.txt);
...
$postdata = http_build_query( array(
'var1' => 'some content',
'var2' => $file
) );
$opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata ) );
$context = stream_context_create($opts);
$result = file_get_contents('http://example.com/submit.php', false, $context);
Thanks
Why don’t you use cURL instead of streams? It’s so easy: