Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Flash upload progress bar problem

Posted on 2008-10-19
5
Medium Priority
?
868 Views
Last Modified: 2013-11-11
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:
http://grhwood.com
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);
	reference.upload(scriptLocation);
}
 
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 {
    removeMovieClip(progressBar);
	display_txt.text = '';
	uploadButton_mc._visible = false;
	chooseButton_mc._visible = true;
}
 
//attach Listener to the FileReference Object
reference.addListener(listener);
 
 
/***********************************************************/
function makeProgressBar(x:Number, y:Number):MovieClip {
	var bar:MovieClip = createEmptyMovieClip('progressBar_mc', 0);
	bar._visible = false;
	bar.beginFill(progressBarColor);
	bar.lineTo(Stage.width, 0);
	bar.lineTo(Stage.width, progressBarHeight);
	bar.lineTo(0, progressBarHeight);
	bar.lineTo(0, 0);
	bar.endFill();
	bar._width = 0;
	bar._visible = true;
	bar._x = x;
	bar._y = y;
	return bar;
}
/*************/

Open in new window

0
Comment
Question by:jmccar68
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 9

Expert Comment

by:Sci-Fi-Si
ID: 22752627
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%

0
 

Author Comment

by:jmccar68
ID: 22754590
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!
0
 
LVL 9

Accepted Solution

by:
Sci-Fi-Si earned 2000 total points
ID: 22756068
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
0
 

Author Comment

by:jmccar68
ID: 22756473
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
http://grhwood.com/upload_file.rar
untitled.JPG
0
 
LVL 9

Expert Comment

by:Sci-Fi-Si
ID: 22756836
Glad I could help

All the best
Sci-Fi Si
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question