Mam pewien problem z curlem, a mianowicie z uploadem plików na maszyne stojącą na wynalazku microsoftu który zwie się IIS

Kod
500 Internal Server Error
An internal server error occurred. Please try again later.
Send failure: Connection was aborted
An internal server error occurred. Please try again later.
Send failure: Connection was aborted
Nad rozwiązaniem problemu siedzę już kilka h i nic nie udało mi sie wymyśleć, więc postanowiłem napisać temat, poniżej zamieszczam kod skryptu:
<?php $ch = curl_init('http://www.example.pl/upload.php'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0); 'User-Agent: '.$useragent.'', 'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'Accept-Language: pl,en-us;q=0.7,en;q=0.3', 'Accept-Encoding: gzip,deflate', 'Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7', 'Keep-Alive: 300', 'Connection: keep-alive' ); curl_setopt($ch, CURLOPT_HTTPHEADER, $naglowki); curl_setopt($ch, CURLOPT_POSTFIELDS, $avatar); curl_exec($ch); $a2 = curl_errno($ch); curl_close($ch); ?>
Pozdrawiam