CURL multipart form post doesn't upload file

From: Date: Sat, 10 Jan 2004 23:17:03 +0000
Subject: CURL multipart form post doesn't upload file
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969358078@lists.php.net to get a copy of this message
Hello, I really hope somebody can help me. On many pages this problem is told, but no one has a solution Attempting to upload image file using libcurl http multipart post. All I get is the file name stuffed into the variable I would expect the temporary file path to be in. No file is uploaded. Reproduce code: --------------- <?php // Sample from PHP Bug report # 14320
$url    = "http://design/uyoffice/test/testrcv.php";
$upfile = "logo.gif"; $ch = curl_init($url); curl_setopt($ch,CURLOPT_HEADER,1); curl_setopt($ch,CURLOPT_VERBOSE,1); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_POST,"1"); curl_setopt($ch, CURLOPT_POSTFIELDS, array('upfile'=>@$upfile)); $result = curl_exec($ch); curl_close($ch); ?> Expected result: ---------------- Expect to have image file uploaded to server, with appropriate PHP variable _FILES["upfile"] array available for file manipulation. Actual result: -------------- No file is uploaded. Instead, I get variable $upfile containing the file address that was to be uploaded. I read somewhere, that the @$upfile is the problem, as the @ doesn't do (any more?) what it's expected to do. PLEASE help me!! Thank you very much!!! Andre

« previous php.doc (#969358078) next »