0

I am opening file in binary mode using

fopen("abhi.zip","rb");

and reading contents from it and appending it to header.

as there are many null characters in "abhi.zip"(zipped file)

It is posting data only till it reads a null character.

i am using httpsendrequest(...);

i am struck here,can anyone please help me...

abhinav
  • 527
  • 3
  • 11
  • 24
  • Post your code to get more accurate responses. Probably you need to encapsulate the binary data somehow since HTML is a text protocol - can you encode as Base64, or use something like XML `CDATA`? – Steve Townsend Jun 20 '11 at 12:57
  • See related question here, upvote the answer if it works for you. MIME looks like the way to go so +1 for response below, as well. http://stackoverflow.com/questions/4516149/how-to-send-mime-over-http – Steve Townsend Jun 20 '11 at 14:56

1 Answers1

2

You are not supposed to stick your POST data into the headers, instead, pass it as the lpOptional parameter, passing its length in dwOptionalLength. You will likely need to encode and wrap your data with the proper MIME boundaries (I could find no clear documentation on whether or not this is needed)

Hasturkun
  • 35,395
  • 6
  • 71
  • 104
  • Thanx alot it worked....i am using loOptional parameter from the beggining but i am using strlen(data) for dwoptionalLength which is giving length less than required length as "data" parameter has NULL character in between.... – abhinav Jun 21 '11 at 05:21