use HTTP::Request::Common; use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $filename = '/tmp/kitten.jpg'; my $req = $ua->request( POST 'https://example.org/', Content_Type => 'multipart/form-data', Content => [ 'file' => [$filename] ] );
Mit Sicherheit gibt es ein Äquivalent in PHP.
Zum Beispiel Guzzle:
$file = '/tmp/kitten.jpg';
$client = new Client();
$response = $client->post(
'https://example.com',
'multipart' => [
[
'name' => basename($file),
'contents' => fopen($file, 'r')
]
]
);