Hi,
I'm developing a PHP script to send the content of a file from one script to another. In PHP usually it's used the $_FILE array that contains any uploaded file submitted in a form. But I didn't needed a form so I came up with something a little different:
// pseudo function names ahead
$content = file_get_contents(FILE_TO_SEND);
send_file_with_curl(base64_encode(gzcompress($content)));
So this basically fetches the content of the file, then compresses it with gzip compression and then base64 encodes it. Then everything is sent with a cURL POST request. On the other side I get sent content base64 decode it, uncompress it and everything comes back untouched.
So my question is: Is there any downside in doing things this way? Are there any security or integrity concerns I might be overlooking?
I forgot to mention that I also send an md5 digest of the file to check if the transfer went ok. And files to be sent will never be more than 3Mb of size.
Thanks in advance for all your answers.