I suggest you to use libcurl instead of wininet. It is portable and much simpler to use. Uploading file example is on their website: http://curl.haxx.se/
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.
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
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:
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
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.