cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

http file upload, setting file name

From: Gordon Rouse <gordon_e_rouse_at_yahoo.com.au>
Date: Thu, 9 Sep 2004 15:39:33 +1000 (EST)

I am interested in knowing if anyone knows how to post
a file as below, but making it so that the server
receives just the file name (in this case file.txt)
rather than the full path specified. ( as a browser
would do it )

///////////////////////////////

$url = "http://www.someurl.com/upload.php";
$postData = array();

$postData[ 'file_name' ] = "@/tmp/file.txt";
                
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1 );

curl_setopt($ch, CURLOPT_POSTFIELDS, $postData );

$response = curl_exec( $ch );
echo $response;

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com
Received on 2004-09-09