I'm getting this weird behavior with libCURL. When I try to upload a file by appending "@" to the beginning of filename (as documented in libCURL's man page), instead of file contents being uploaded, libCURL sends the filename itself (with the @ in the beginning).
This is running on Windows 2008 R2, with xampp version 5.6.8, which has curl compiled in (curl version 7.40.0).
Here's releant code fragment:
$post['pic'] = "@C:\\image.png";
$ret = curl_setopt( $ch, CURLOPT_POST, TRUE );
if (!$ret) die("curl_setopt CURLOPT_POST failed");
$ret = curl_setopt( $ch, CURLOPT_POSTFIELDS, $post );
if (!$ret) die("curl_setopt CURLOPT_POSTFIELDS failed");
$response = curl_exec( $ch );
This code works on Linux but not Windows Server 2008.
Here's the form data that I get:
Content-Type: multipart/form-data; \\
boundary=------------------------c74a6af8b52d997a
--------------------------c74a6af8b52d997a
Content-Disposition: form-data; name="pic"
@C:\image.png
--------------------------c74a6af8b52d997a--
As you can see I receive @C:\image.png
rather than contents.
Does anyone know why libCURL wouldn't upload the file contents?