So for every byte in an images your sending many bytes to you server. The sever parses the received bytes string and figures which bytes is for the image data and adds it the to image data that that has been received so far or start a new image and if the last image data byte writes and image file. So you have inflated the amount of data many times. Is it a compress jpeg or uncompressed jpeg your transmitting. All told how mad bytes to you transmit and decode for that 532KB image. Hoe do you convet a byte to as you wrote to "hexadecimal" is it a one to one conversion is not a byte not hexadecimal to begin with. Are you doing some kind of data conversion? If Web Servers and Web browsers transmitted images you way how long would it take to display an image.
JJMack, your words of wisdom saved me.
I realized that when I am sending the raw data as a string I already multiplied the amount of data.
So I changed my approach and now I am sending the raw binary data with a couple of headers:
When I wrap my content in a nice boundary I am able to send a 270kb jpeg in less than 10 seconds.
The major bonus I that now I can use PHP's native $_FILES global.