Pages: 12
Last edited on
I suggest you to use libcurl instead of wininet. It is portable and much simpler to use. Uploading file example is on their website:
i need to do it with HttpSendRequest thanks anyway
Last edited on
Microsoft already implements base64 encoding through theit propietary Crypto API or you can use an open source alternative. Of course, then the data needs to be decoded on the PHP script first to use it and so you complicate things more than can be. Use libcurl instead.
Last edited on
hi the reason im using this is cos im going to be hooking it and changing what image is uploaded.
thats why i need to know how this works and get a working example
Last edited on
Last edited on
Can someone please help me?
line 33 cannot work. You cannot sprintf buffer to buffer. Plus you cannot treat a binary like a jpg as if it'd be a string.

As modoran pointed out html doesn't allow binary. The best would be to have just a link to the image. That'd save you the work to read the image. Look at this:
thats html though.

im trying to send a image to .php script i have been told that it has to binary
and line 33 dose work when i log it it is all showing in my log right.
its just that the image isnt working right
Ok try this:
	sprintf(buffer,"%s\r\nContent-Disposition: form-data; name=\"PlayerName\"\r\n\r\n"
	"Content-Disposition: form-data; name=\"Screenshot\"; filename=\"%s\"\r\n"
	"Content-Type: image/png\r\n\r\n"

	size_t buffer_len = strlen(buffer);
	memcpy(buffer + buffer_len, content, lSize);
	return HttpSendRequestA(hRequest, lpszHeaders, dwHeadersLength, buffer, buffer_len + lSize);

After you appended the binary you can't use strlen() anymore (because the binary may contain 0).
I just wonder how they determine the start of the image
that seems to work better as it is returning the right buffer size well it looks about right.

but its still not uploading the image to the php.

Maybe your request isn't right yet:
The thing is I'm trying to change the uploaded file.
So I hooked it and logged what it was writing an sending to the php.
My code shows it the same in the loged text as the normal one did.
hm, do you think you request is right? According to the link above it looks slightly different.

What about Content-Length

My code shows it the same in the loged text as the normal one did.
What does that mean? What's the "normal one"?
Last edited on
My opinion is that the request isn't correct. But that's something you should ask in a php forum
Pages: 12