Código PHP:
import flash.net.FileReference;
var arrTypes:Array = new Array();
var objTypes:Object = new Object();
objTypes.description = "Images (*.jpg, *.jpeg, *.gif, *.png)";
objTypes.extension = "*.jpg; *.jpeg; *.gif; *.png";
arrTypes.push(objTypes);
var listUpload:Object = new Object();
var fileUpload:FileReference = new FileReference();
fileUpload.addListener(listUpload);
btbrowse.onRelease = function() {
fileUpload.browse(arrTypes);
}
btenviar.onRelease = function() {
fileUpload.upload("upload.php?action=upload");
}
listUpload.onSelect = function(file) {
txtarchivo.text = file.name;
}
listUpload.onProgress = function(file, bytesLoaded, bytesTotal):Void {
txtestado.text = "Subiendo archivo " + Math.round(bytesLoaded*100/bytesTotal) + "%";
}
listUpload.onComplete = function(file:FileReference):Void {
txtestado.text = "Archivo subido correctamente";
}
listUpload.onComplete = function (file:FileReference):Void {
txtestado.text = "Downloading preview...";
downloadImage(selectedFile.name);
}