Witam. Wysyłam POST na server i wywala mnie przy błędzie.

Oto błąd :

[JAVASCRIPT] pobierz, plaintext
  1. Error thrown at line 11, column 8 in ajaxTest() in http://*******/~metis/php.php:
  2. client.onreadystatechange = function()
  3. called from line 1, column 0 in <anonymous function>(event):
  4. ajaxTest()
[JAVASCRIPT] pobierz, plaintext



To moj kod :
  1. $login_ip = "ip servera";
  2. $login_port = "port";
  3. $folder_id = "folder na serverze";
  4. $sessia = "numer sessi";
  5. $filename = "\home\metis\pobrane\plik_do_testu.txt";
  6. $filename_len = strlen($filename);
  7.  
  8. $post = folder_id=".$folder_id."&session_nr=".$sessia."& HTTP/1.1 Connection: close User-Agent: ***** Host: ***** Content-Length: ".$filename_len." ".$filename;

[JAVASCRIPT] pobierz, plaintext
  1. <script type="text/javascript">
  2. function ajaxTest()
  3. {
  4. var client = new XMLHttpRequest();
  5. client.open('POST', "<?php echo $login_ip.":".$login_port."/upload/" ?>", true);
  6. client.setRequestHeader('Content-Type',
  7. 'application/x-www-form-urlencoded; charset=UTF-8');
  8.  
  9. client.send("<?php echo $post ?>");
  10. client.onreadystatechange = function()
  11. {
  12. if (200 === this.status && 4 === this.readyState)
  13. {
  14. alert('status: ' + this.statusText + '\n' +
  15. this.responseText);
  16. }
  17. }
  18. }
  19. </script>
[JAVASCRIPT] pobierz, plaintext

  1. <title>TEST AJAX</title>
  2. <meta http-equiv="content-type" content="text/html;charset=utf-8" />
  3. <script type="text/javascript">
  4. <!-- Tu jest kod JavaScript co podałem wyżej-->
  5. </script>
  6. </head>
  7. <div onclick="ajaxTest()" id="content">Kliknij aby wysłać post/plik.</div>
  8. </body>
  9. </html>