So your basically trying to make this an upload script? Why not just create an upload page? What exactly are you trying to upload and to where? Using ajax, and php you could create an intuitive ui with excellence features. If you wanted to send a file why not use curl or heck even ftp functions in a client server system. You could create a simple multi-file upload using simple code. Of you could upload from a folder to a remote server using curl or the ftp functions. I think you need to develop the idea farther and determine exactly what you want this script to do and how you can implement each feature. You could also use this function which works better and is faster. http://www.php.net/manual/en/function.finfo-file.php
There are so many ways to tackle the task that you've set up but you need to first understand what it is your trying to do. As far as your idea you need a client to receive the file and process it and a server that does the actual labor. Of course you could have multiple clients that use the server but a client server system is probably your best shot. You could also write a p2p system but using php it would be very limited to just being a web or crude cli program.
Darker like this