Multiple values for the same key and file uploads using cURL and PHP "solution"

So, after four days of asking questions at various places (including the cURL PHP mailing list and Stackoverflow) I have come to a solution to this on my own. To the best of my knowledge, the cURL PHP bindings do not support sending more than one value for the same key, whether I specify the [] at the end of the key name or not (although it is important to note that the field that I had to send was actually tag, and not tag[] so that point really doesn't matter). The solution was to build a multipart/form-data string and set that for CURLOPT_POSTFIELDS. Usage is as follows

https://gist.github.com/288240

... and the function:

https://gist.github.com/288242

It can most definitely use some work. I do not know the hash stuff well enough to know whether or not one could always assume sha1 or md5 will always be available. I wrote it this way to be safe. If either of those are not available, just use the first one there and hopefully that would suffice.