$_SERVER["CONTENT_LENGTH"] returning zero when uploading a file using XmlHttpRequest $_SERVER["CONTENT_LENGTH"] returning zero when uploading a file using XmlHttpRequest php php

$_SERVER["CONTENT_LENGTH"] returning zero when uploading a file using XmlHttpRequest


Solved it! Seems the jQuery script I am using fails under firefox 3.5.x, I updated to 3.6.9 and it works fine.

Now I have to find some way to make it backwards compatible with older versions of firefox.


Did you set your encoding type to multipart/form-data ?

<form action="upload.php" method="post" enctype="multipart/form-data">  ...  <input type="file" ... />  ...</form>


It's possible that chunked encoding is being used, which wouldn't send content length.