以二进制流的类型post发送文件

php:

 array(
					'method' => 'POST',
					'header' => 'content-type:application/x-www-form-urlencoded',
					'content' => $file
			)
	);
	$context = stream_context_create($opts);
	$response = file_get_contents($url, false, $context);
	return $response;
	
}

命令行:

curl -X POST --data-ascii @filepath http://host:port/api/upload_apk/


你可能感兴趣的:(curl)