Upload file to php script

Hi to whole,

I have a question about this code found in Stackoverflow website =>


I have seen what the author this topic answer what had resolved problem add to code base64 codification before send data. I already make a "reproduction" based in he speak like this:

sprintf(hdrs,"Content-Transfer-Encoding: base64; boundary=%s",boundary,content);

but not had success.

Some suggestion?

All will be welcome! Thank.

PS: Sorry my English :D
Last edited on
sprintf(hdrs,"Content-Transfer-Encoding: base64; boundary=%s",boundary,content); Content doesn't have a format specifier and won't be written.

Did you read the answer to the post? The answer was don't use sprintf to try to format binary data, but that's exactly what you're trying to do.
base64 is NOT binary data, so it should be safe to use sprintf in this case. However this is not the proper way to upload a file to a webserver (the size will increase and you should already have data encoded in base64)
Thanks for reply,

You is correct KBW, I only not understood how he make work this using base64 encode :D .
Topic archived. No new replies allowed.