Re: Curl fiel Upload

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

on 01/20/2009 09:10 PM Matthias Laug said the following:
> I've got a problem using curl to upload a file. I want to send it to a form
> written with the Django Framework.
> 
> Post Request are processed correctly, with one anomaly.
> This piece of code works fine
> 
>     curl_setopt($process, CURLOPT_POSTFIELDS, http_build_query($data));
> 
> But if i provide only an array no data is send to the form
> 
>     curl_setopt($process, CURLOPT_POSTFIELDS, $data);
> 
> I have read somewhere that curl sends formdata with enctype="form/mulitpart"
> only if I provide an array not a string.
> 
> If I add "@filename" to the $data variable (string or array) it does not
> send the file to the form.
> 
> Each example I have found in the internet so far did not work.

I do not use the Curl functions directly. When possible I use fsockopen
as alternative and use this HTTP client class to submit any kind of HTTP
requests. Take a look at the test_http_post.php to see how simple is to
submit form with one or more file uploads.

http://www.phpclasses.org/httpclient



-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux