curl-library
Re: libcurl passing a file to remote server
Date: Wed, 12 May 2010 12:04:53 +0200
On 12 May 2010 11:12, Simon Suchomel <suchomel_at_fi.muni.cz> wrote:
> Dear members, could you please guide me how to pass a file to a destination server via libcurl in perl?
>
> I am unable to pass a functional file handle, I'm trying to pass the handle via setopt with CURLOPT_POSTFIELDS option. I need to pass file as CGI parameter named FILE from the point of view of the target URL.
>
> The same as on command line: curl -F 'FILE=@/home/myfile' https://someurl
> It works fine via command line, thus I need to find alternative to the -F 'FILE=@/path' parameter via libcurl, but I'am unable to find it.
>
> Thank you very much for any hint.
Try running:
$ curl -F 'FILE=@/home/myfile' https://someurl --libcurl postfields-example.c
and then look at the file called postfields-example.c that gets created.
-- Michael Wood <esiotrot_at_gmail.com> ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2010-05-12