2010-12-01 24 views
0

リモートホストにファイルをアップロードするc_urlを使用しています。ここに私のコードです。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"、フルパスではない必要があります。不正なファイル名を除き、ファイルを正常にアップロードできます。

私のコードで何が間違っていますか?

ありがとうございました!

答えて

0
$data = array('name' => 'Foo', 'file' => '@/home/autouvl/public_html/asmallorange/log.txt;filename=log.txt'); 
+0

ありがとうございます。私のテストとして、それはうまくいかなかったようです。私は私の問題を解決した、私はポストボディmuanllyを建設した。 – Sean

関連する問題