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?

thank you!

Answers


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

Need Your Help

Ruby - strings operation

ruby string

I have this simple helper:

Get type from GUID

c# .net reflection types

For various reasons, I need to implement a type caching mechanism in C#. Fortunately, the CLR provides Type.GUID to uniquely identify a type. Unfortunately, I can't find any way to look up a type b...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.