Using c_url upload file to remote host, file name is incorrect
Using c_url upload file to remote host. here is my code.
<?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: in my receivefile.aspx. I got the file name is "/home/autouvl/public_html/asmallorange/log.txt". but I want It should be "log.txt", not full path. file can be uploaded successfully except incorrect file name.
what's wrong in my code?
$data = array('name' => 'Foo', 'file' => '@/home/autouvl/public_html/asmallorange/log.txt;filename=log.txt');