# Upload script needs progress bar

**URL:** <https://forum.kirupa.com/t/upload-script-needs-progress-bar/304813>\
**Category:** Uncategorized\
**Created:** [February 14, 2010, 8:03pm UTC](https://forum.kirupa.com/t/upload-script-needs-progress-bar/304813 "2010-02-14T20:03:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bobcahill](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@bobcahill](https://forum.kirupa.com/u/bobcahill)\
**Post date:** [February 14, 2010, 8:03pm UTC](https://forum.kirupa.com/t/upload-script-needs-progress-bar/304813/1 "2010-02-14T20:03:22Z")

</div>

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

```auto

$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;
&lt;/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?
```
