Hello,
More questions about the flash 8 file uploads:
I'm trying to use this script to upload files on a secure (https) server and the script does not work. The same script works fine on a regular http server.
///// import the FileReference Object
import flash.net.FileReference;
////// initial settings
upload_butn_1.enabled = false;
////// the fileReference object
var file_fr:FileReference = new FileReference(); //FileReferenceList(); //new ;
////// object for listening to for FileReference events
var list_obj:Object = new Object();
list_obj.onSelect = function()
{
upload_butn_1.enabled = true;
name_txt_1.text = file_fr.name;
name_txt_2.text = file_fr.name;
}
list_obj.onComplete = function()
{
name_txt.text = "All Done";
rec_mc.clear();
upload_butn_1.enabled = false;
}
list_obj.onProgress = function (file_fr:FileReference, bytesLoaded:Number, bytesTotal:Number)
{
txt_output_2 = "\n Progress: " + file.name + " (" + Math.round(bytesLoaded / bytesTotal * 100) + "%)";
percentLoaded = Math.round( bytesLoaded / bytesTotal * 100);
_root.loader.bar._xscale = percentLoaded;
_root.loader.txt_percent = percentLoaded + " % ( " + Math.round( bytesLoaded ) + " of " + Math.round( bytesTotal ) + " Bytes Loaded )";
}
//--- if a user selects cancel --------------
//-------------------------------------------
list_obj.onCancel = function()
{
name_txt.text = "Cancel was selected";
}
//-------------------------------------------
//---- if there is an IO error --------------
//-------------------------------------------
list_obj.onIOError = function( fileRef ){ txt_output_2 += "\n IO error with " + fileRef.name + " error: " + error; }
//-------------------------------------------
//---- security error problem ---------------
//-------------------------------------------
list_obj.onSecurityError = function( fileRef, error )
{
txt_output_2 += "\n Security error with " + fileRef.name + ":" + error;
}
//-------------------------------------------
//---- httpError ----------------------------
//-------------------------------------------
list_obj.onHTTPError = function( fileRef:FileReference, error:Number )
{
txt_output_2 += "\n HTTP error: with " + fileRef.name + ":error #" + error;
}
//-------------------------------------------
//---- attach the listener ------------------
//-------------------------------------------
file_fr.addListener( list_obj );
//-------------------------------------------
//---- the event for the browse buttons ------
//-------------------------------------------
browse_butn_1.clickHandler = function()
{
file_fr.browse( [ {description: "JPEGs", extension: "*.jpg;*.gif;*.png"} ] );
txt_output_2 += "\n button 1 clicked";
}
browse_butn_2.clickHandler = function()
{
file_fr.browse( [ {description: "JPEGs", extension: "*.jpg;*.gif;*.png"} ] );
}
//-------------------------------------------
//---- the event for the upload button ------
//-------------------------------------------
upload_butn_1.clickHandler = function()
{
file_fr.upload(" txt_output_2 += "\n upload_butn_1 clicked";
rec_mc.fillColor = Math.random()*0x1000000;
}
//-------------------------------------------
Thanks for any help,
Clem C
More questions about the flash 8 file uploads:
I'm trying to use this script to upload files on a secure (https) server and the script does not work. The same script works fine on a regular http server.
///// import the FileReference Object
import flash.net.FileReference;
////// initial settings
upload_butn_1.enabled = false;
////// the fileReference object
var file_fr:FileReference = new FileReference(); //FileReferenceList(); //new ;
////// object for listening to for FileReference events
var list_obj:Object = new Object();
list_obj.onSelect = function()
{
upload_butn_1.enabled = true;
name_txt_1.text = file_fr.name;
name_txt_2.text = file_fr.name;
}
list_obj.onComplete = function()
{
name_txt.text = "All Done";
rec_mc.clear();
upload_butn_1.enabled = false;
}
list_obj.onProgress = function (file_fr:FileReference, bytesLoaded:Number, bytesTotal:Number)
{
txt_output_2 = "\n Progress: " + file.name + " (" + Math.round(bytesLoaded / bytesTotal * 100) + "%)";
percentLoaded = Math.round( bytesLoaded / bytesTotal * 100);
_root.loader.bar._xscale = percentLoaded;
_root.loader.txt_percent = percentLoaded + " % ( " + Math.round( bytesLoaded ) + " of " + Math.round( bytesTotal ) + " Bytes Loaded )";
}
//--- if a user selects cancel --------------
//-------------------------------------------
list_obj.onCancel = function()
{
name_txt.text = "Cancel was selected";
}
//-------------------------------------------
//---- if there is an IO error --------------
//-------------------------------------------
list_obj.onIOError = function( fileRef ){ txt_output_2 += "\n IO error with " + fileRef.name + " error: " + error; }
//-------------------------------------------
//---- security error problem ---------------
//-------------------------------------------
list_obj.onSecurityError = function( fileRef, error )
{
txt_output_2 += "\n Security error with " + fileRef.name + ":" + error;
}
//-------------------------------------------
//---- httpError ----------------------------
//-------------------------------------------
list_obj.onHTTPError = function( fileRef:FileReference, error:Number )
{
txt_output_2 += "\n HTTP error: with " + fileRef.name + ":error #" + error;
}
//-------------------------------------------
//---- attach the listener ------------------
//-------------------------------------------
file_fr.addListener( list_obj );
//-------------------------------------------
//---- the event for the browse buttons ------
//-------------------------------------------
browse_butn_1.clickHandler = function()
{
file_fr.browse( [ {description: "JPEGs", extension: "*.jpg;*.gif;*.png"} ] );
txt_output_2 += "\n button 1 clicked";
}
browse_butn_2.clickHandler = function()
{
file_fr.browse( [ {description: "JPEGs", extension: "*.jpg;*.gif;*.png"} ] );
}
//-------------------------------------------
//---- the event for the upload button ------
//-------------------------------------------
upload_butn_1.clickHandler = function()
{
file_fr.upload(" txt_output_2 += "\n upload_butn_1 clicked";
rec_mc.fillColor = Math.random()*0x1000000;
}
//-------------------------------------------
Thanks for any help,
Clem C