AS3 Delay a for loop

I’m writing an upload program to upload multiple files. It works great as long as I only upload one file but as soon as I add a second file it throws an error saying it can only perform one upload at a time. Is there a way I can have it not loop back through the for loop until the upload has completed?

Here is a chunk of my code


for(var q:int = 0; q < selectedFileArray.length; q++)
{
	trace("Loop marker 1");
	fr.addEventListener(Event.COMPLETE, completeHandler);
	fr.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) }); 
	fr = FileReference(selectedFileArray[q]);
	fullfile = fr.name;
	filesplit = fullfile.split(".");
	fileext = filesplit[1];
	var uprequest:URLRequest = new URLRequest("www.myaddy.com");
	fr.upload(uprequest);
	function completeHandler(event:Event):void{ trace("Upload complete"); }
}