2010-12-01 9 views
0

Utilisation du fichier de transfert c_url vers l'hôte distant. voici mon code.Utilisation du fichier de transfert c_url vers l'hôte distant, le nom de fichier est incorrect

<?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)); 
?> 

Question: dans mon receivefile.aspx. J'ai obtenu le nom de fichier est "/home/autouvl/public_html/asmallorange/log.txt". mais je veux que ce soit "log.txt", pas le chemin complet. le fichier peut être téléchargé avec succès, sauf le nom de fichier incorrect.

Qu'est-ce qui ne va pas dans mon code?

merci!

Répondre

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

merci beaucoup. comme mon test, semble que ça ne marchait pas bien. J'ai résolu mon problème, j'ai construit post corps muanlly. – Sean

Questions connexes