Thanks for taking the time to read this!
i can’t seem to get this to work. i read thru but still nothing…
i keep getting the “HTTP Error #403”. all my permissions are set to “777” (tests folder and php script). maybe my script is wrong?
if anyone out there has used this file and can offer some insight that would be helpful.
Thanks for helping,
Andre
here is a link to the page:
monkeyheadgraphics.com/tests/up.html
here is my php code:
<?php
if ($_FILES[‘Filedata’][‘name’]) {
move_uploaded_file($_FILES[‘Filedata’][‘tmp_name’], ‘public_html/tests/’ . basename($_FILES[‘Filedata’][‘name’]));
}
?>
here is my Actionscript:
import flash.net.FileReference;
var progressBar:MovieClip;
var reference:FileReference = new FileReference();
var referenceListener:Object = {};
var scriptLocation:String = ‘uploader.php’;
var progressBarHeight:Number = 10;
var progressBarY:Number = 50;
var progressBarColor:Number = 0x66ccff;
uploadButton_mc._visible = false;
reference.addListener(referenceListener);
referenceListener.onSelect = activateUploadButton;
referenceListener.onProgress = updateProgress;
referenceListener.onComplete = restart;
referenceListener.onHTTPError = handleError;
referenceListener.onIOError = handleError;
referenceListener.onSecurityError = handleError;
chooseButton_mc.onRelease = choose;
uploadButton_mc.onRelease = uploadCurrent;
function activateUploadButton():Void {
display_txt.text = reference.name;
uploadButton_mc._visible = true;
}
function choose():Void {
reference.browse([{description:‘All Files (.)’, extension:’.’}]);
}
function handleError(errorName:String, detail:Object):Void {
restart();
if (arguments.length === 2) {
if (typeof detail === ‘number’) {
display_txt.text = ‘HTTP Error #’+detail;
} else {
display_txt.text = 'Security Error: ‘+detail;
}
} else {
display_txt.text = ‘IO Error’;
}
}
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;
}
function restart():Void {
removeMovieClip(progressBar);
display_txt.text = ‘’;
uploadButton_mc._visible = false;
chooseButton_mc._visible = true;
}
function updateProgress(fileReference:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
display_txt.text = fileReference.name+’ - '+Math.ceil((bytesLoaded/bytesTotal)100)+’%’;
progressBar._width = Math.ceil(Stage.width(bytesLoaded/bytesTotal));
}
function uploadCurrent():Void {
chooseButton_mc._visible = false;
progressBar = makeProgressBar(0, progressBarY);
reference.upload(scriptLocation);
}