• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 874
  • Last Modified:

Flash upload progress bar problem

I have problem with my flash upload progress bar. It works perfectly on localhost. But when i upload it on server, the progress bar doesn't work correctly. Please help me.
Here is my demo:
import flash.net.FileReference;
var reference:FileReference = new FileReference();
var listener:Object = new Object();
//server script
var scriptLocation:String = 'uploader.php';
var progressBarHeight:Number = 10;
var progressBarY:Number = 50;
var progressBarColor:Number = 0x66ccff;
uploadButton_mc._visible = false;
chooseButton_mc.onRelease = choose;
uploadButton_mc.onRelease = uploadCurrent; //upload file
function choose():Void {
	reference.browse([{description:'All Files (*.*)', extension:'*.*'}]);
function uploadCurrent():Void {
	chooseButton_mc._visible = false;
	progressBar = makeProgressBar(0, progressBarY);
listener.onSelect = function(file:FileReference):Void {
	display_txt.text = file.name;
	uploadButton_mc._visible = true;
listener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
	percent = Math.ceil(bytesLoaded*100/bytesTotal);
    display_txt.text = file.name+' - '+ percent +'%';
	progressBar._width = Math.ceil(Stage.width*(bytesLoaded/bytesTotal));
	percent_txt.text = bytesLoaded + "/" + bytesTotal;
listener.onComplete = function(file:FileReference):Void {
	display_txt.text = '';
	uploadButton_mc._visible = false;
	chooseButton_mc._visible = true;
//attach Listener to the FileReference Object
function makeProgressBar(x:Number, y:Number):MovieClip {
	var bar:MovieClip = createEmptyMovieClip('progressBar_mc', 0);
	bar._visible = false;
	bar.lineTo(Stage.width, 0);
	bar.lineTo(Stage.width, progressBarHeight);
	bar.lineTo(0, progressBarHeight);
	bar.lineTo(0, 0);
	bar._width = 0;
	bar._visible = true;
	bar._x = x;
	bar._y = y;
	return bar;

Open in new window

  • 3
  • 2
1 Solution
Just uploaded a couple of test files (so you might to delete them) but the process worked fine, file size was correct and completed at 100%

jmccar68Author Commented:
I'm using Firefox 3.0 and when i upload a file, the progress bar goes to 100% even my file isn't uploaded.
Please help me!
Which type of code are you using to upload this file, is it flash, php or other.
Have a look at your uploader.php file and confirm which directory the file is being uploaded to. The transfer looks ok, the byte count as the upload takes looks ok, I strongly suspect its the directory.

Do you have the same problem if you try uploading locally?

All the best
Sci-Fi Si
jmccar68Author Commented:
Thank you Sci-Fi-Si,

I tried uploading with another computer, and it works correctly. Only when i upload using my pc, the problem occurs.
I attach my screen shot below. And here is my source
Glad I could help

All the best
Sci-Fi Si
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now