Major changes to Mega Upload

2004 April 14 at 09:16 » Tagged as :

I have just released version 1.40 of mega upload, my progress monitor for PHP file uploads. This version should scale better than older versions because the architecture has changed.

note: before you read this blog entry you might want to take a quick look at the mega upload intro. Don't worry it's brief.

In the older versions the browser would post the data to a perl script. The perl script would process the incoming data and keep a marker on the server's hardisk. This marker will be accessed by another script which would calculate the progress and show what percentage has been uploaded. The data would then be posted again by the perl script to the php script. This second 'internal' post would allow the php developer to take charge of the file upload from there on.

In the new version the perl script still accepts the incoming post data but instead of re-posting the data to the target php script, the perl script accepts the responsibility of processing the post data, extracting the files from it and saving it to disk. Once this has been done a list of file are passed to the target php script.

Now the php script is no longer directly responsible for processing the file upload - it doesn't really matter anyway because the PHP engine used to take care of this for you. But you do need to make a small change. Just replace all occurances of $_FILE with $_REQUEST and your script will work just the way it used to - except it may take up a little less memory.