Re: CURL multipart form post doesn't upload file
| From: | Gabor Hojtsy | Date: | Sun, 11 Jan 2004 09:38:43 +0000 |
| Subject: | Re: CURL multipart form post doesn't upload file | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969358082@lists.php.net to get a copy of this message | ||
Hi Andre!
As the name of this mailing list suggest, it is established for people
working on the PHP documentation. Please ask support questions at
php-general@lists.php.net, or if you are not keen on mailing lists, see
http://php.net/gethelp for more information.
Goba
> 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
>
>