What I suggested above was to inspect the "request" before it is sent, since you seemed to think that it was not set up properly.
At this point, I'm pretty sure the request is perfect! Thank you for the help. I taking that function out of the overall script and running it byitself, seems to work fine. The problem must be all mine, although for the life of me I can't seem to figure out what it would be. When I run the function in it's own script not as a function, the file size appears to transmit correctly. When the function as a function within the bigger script the size is always wrong. I've done character by character comparisons between the function and it's stand alone mode and can't seem to find any real difference. Really quite baffling at this point.
Thank you again for all of the help. You definitely pointed me in the right direction.
