You can check this sample code: http://www.besthostingforums.com/92-...am-script.html
Filesonic is dead now, but you can learn from the code to stream directly to user and then change to host of your choice.