c_urlアップロードファイルをリモートホストに使用します。これが私のコードです。
<?php
/* http://localhost/upload.php:
print_r($_POST);
print_r($_FILES);
*/
$ch = curl_init();
$data = array('name' => 'Foo', 'file' => '@/home/autouvl/public_html/asmallorange/log.txt');
curl_setopt($ch, CURLOPT_URL, 'http://www.test.com/test/receivefile.aspx');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
echo(curl_exec($ch));
?>
質問:私のreceivefile.aspxで。ファイル名は"/home/autouvl/public_html/asmallorange/log.txt"
です。ただし、フルパスではなく「log.txt」にする必要があります。間違ったファイル名を除いて、ファイルは正常にアップロードできます。
私のコードの何が問題になっていますか?
ありがとう!