Ok ecco il codice contenuto nella movie:
//
//
if(!allow_featured)
{
featured_txt1.hide;
featured_txt2.hide;
featured.text = "n";
featured.hide;
}
//import the FileReference Object
import flash.net.FileReference;
//initial settings
upload_butn.enabled = false;
//the fileReference object
var file_fr:FileReference = new FileReference();
var seconds:Number = 0;
var var_seconds:Number = 0;
//object for listening to for FileReference events
var list_obj:Object = new Object();
var upload = "";
list_obj.onSelect = function(){
var total = file_fr.size / 1024;
if((total/1024) > limit)
{
done_bloc.text = 'The File you have selected is to large. \n Please try again.';
}
else
{
var allowed_s:Array = allowed.split("|");
var is_good:Boolean = false;
var allow:String = file_fr.name;
name_txt.text = file_fr.name;
var allow13:Array = allow.split(".");
var ct1:Number = allow13.length;
ct1 = (ct1 - 1);
var allow1:String = allow13[ct1];
percent_txt.text = "0";
totalup.text = "0";
totalsize.text = Math.round(total);
download_txt = '';
//sdone_bloc.text += allow1+' | '+allow13+' | '+ct1+' | '+file_fr.name+'\n\n';
for (var i = 0; i < allowed_s.length; i++)
{
//done_bloc.text += allowed_s* + ' != '+allow1 +' | '+ allow13.length+ '\n';
if(!isgood)
{
if(allowed_s* == "*")
{
isgood = true;
}else if(allowed_s* == allow1)
{
isgood = true;
}
else
{
isgood = false;
}
}
}
if(isgood)
{
done_bloc.text = '';
upload_butn.enabled = true;
}
else
{
upload_butn.enabled = false;
done_bloc.text = 'The File you have selected is not Allowed. \n Please try again.';
}
}
}
list_obj.onComplete = function(){
name_txt.text = "File Uploading Complete";
//getURL('flash.php?sid='+sessionid,"frame");
dtext.text = dtext;
rec_mc.clear();
var total = file_fr.size / 1024;
var sofar = file_fr.size / 1024;
percent_txt.text = "100";
totalup.text = Math.round(sofar);
totalsize.text = Math.round(total);
upload_butn.enabled = false;
browse_butn.enabled = false;
done_bloc.text = 'Thank You For Uploading a File.\nPlease wait while we redirect you.';
getURL(server+'/index.php?p=flash&secid='+secid+"&urlsent="+upload,'_top')
stop();
}
list_obj.onProgress = function (bytesTotal, bytesLoaded)
{
var percent = bytesLoaded/file_fr.size;
var remaining = file_fr.size - bytesLoaded;
var total = file_fr.size / 1024;
var sofar = bytesLoaded / 1024;
var var_bytes = bytesLoaded - var_seconds;
upload_butn.enabled = false;
browse_butn.enabled = false;
percent_txt.text = Math.round(percent*100);
totalup.text = Math.round(sofar);
totalsize.text = Math.round(total);
drawRec(percent);
}
// When Upload is complete, fetch the download URL
//myData.onLoad = function(){
//download_txt.text = this.dtext;
//};
//if a user selects cancel
list_obj.onCancel = function(){
}
//if there is an IO error
list_obj.onIOError = function(fileRef){
name_txt.text = "IO error with " + fileRef.name;
}
//security error problem
list_obj.onSecurityError = function(fileRef, error){
name_txt.text = "Security error with " + fileRef.name + ":" + error;
}
//httpError
list_obj.onHTTPError = function(fileRef:FileReference, error:Number){
name_txt.text += "HTTP error: with " + fileRef.name + ":error #" + error;
}
//attach the listener
file_fr.addListener(list_obj);
//the event for the browse button
browse_butn.clickHandler = function(){
file_fr.browse([{description: "Files", extension: "."}]);
}
//the event for the upload button
upload_butn.clickHandler = function()
{
var featured_1;
if(featured.text.charAt(0) == 'y')
{
featured_1 = 1;
}
else
{
featured_1 = 0;
}
if(!allow_featured)
{
featured_1 = 0;
}
var upload1 = server + "/index.php?p=upload&flash=true&sid=" + secid + "&server=" + server1 + "&secid=" + secid +
"&description=" + desc_txt.text + "&password=" + pass_txt.text + "&featured=" + featured_1+ "&user=" + loggeduser;
upload = upload1;
file_fr.upload(upload1);
//var fill = Math.round(Math.random()*0x1000000);
var fill = 5020203;
//fill_c.text = fill;
rec_mc.fillColor = fill;
}
//drawing the rectangle
function drawRec (per){
rec_mc.clear();
rec_mc.lineStyle(0);
rec_mc.beginFill(rec_mc.fillColor, 70);
rec_mc.lineTo(perrec_mc._width, 0);
rec_mc.lineTo(perrec_mc._width, rec_mc._height);
rec_mc.lineTo(0, 30);
rec_mc.lineTo(0,0);
rec_mc.endFill();
}
Vi prego aiutatemi
Grazie in anticipo