As you seem to have no errors reading stdin, perhaps the 
data being uploaded is corrupt or in the wrong format?

Your HTML form should look like this:

<form action="/cgi-bin/upload.c" method="post" 
enctype="multipart/form-data">
...
</form>

Note the enctype parameter. Sending raw binary data via 
stdin is not going to work! Sooner or later the data will 
contain a sequence of bytes that will be indistinguishable 
from EOF. The enctype tells the browser how to send the 
data.

The encoded data will be up to three times bigger than the 
original data, because a single byte of value 0xFF will be 
encoded by the browser as "%FF" (3 chars) and so on.

Once you have the encoded data, you'll need to decode it. 
Fortunately that's not too difficult.

David

Reply via email to