http://qs321.pair.com?node_id=1212676


in reply to Re: POST file through REST::Client
in thread POST file through REST::Client [SOLVED]

You can use that solution in your module

sub postSnippetsFile { my ( $self, %options ) = @_; my $request = HTTP::Request::Common::POST( '', 'Content_Type' => 'form-data', 'Content' => [ file => [ $options{file} ] ], ); $request->authorization_basic($options{username},$options{password +}); #print Dumper $request; my $headers = { 'Content-Type' => $request->header('Content-Type'), "Authorization" => $request->header('Authorization'), }; my $body_content = $request->content; #print Dumper $headers,$body_content; $self->{_client}->POST( $options{url}, $body_content ,$headers ); #print $self->{_client}->responseCode(); return $self->{_client}->responseContent(); }
poj

Replies are listed 'Best First'.
Re^3: POST file through REST::Client
by thanos1983 (Parson) on Apr 11, 2018 at 13:33 UTC

    Hello poj,

    Thanks a lot for your time and effort. It works as expected.

    BR / Thanos

    Seeking for Perl wisdom...on the process of learning...not there...yet!