Upload script needs progress bar

I have a working upload script of which after it checks file format, size and other things this code is executed:


$success = move_uploaded_file($_FILES['image']['tmp_name'], UPLOAD_DIR.$username.'/'.$now.'-'.$file);
					//}
					if($success) {
						$result = "$file uploaded successfully";	
					}
					else {
						$result = "Error uploading $file. Please try again.";
					}	
					break;
</code]

I want to add in a loading bar as a lot of the files will be 20-30 MBs that will take a while. I need a 0-100 percent graphic that updates. I can do it in ActionScript with a getBytesLoaded/getBytesTotal with the Timer object. What is the best approach here. Use Javascript, AJAX, or is there an entire PHP option? So I need a way to refresh every couple of seconds to get the current file size loaded compared to the file size total. Anyone have a direction they can point me in?