JavaScript FLash 8 FileReference and FileReferenceList Unofficial Porting


This JavaScript file is an unofficial porting of the great original Flash 8 FileReference and FileReferenceList class.
It allows developers to manage a FileReference or FileReferenceList instance without a Flash IDE,
just with JS, and manage with your JS skills all kinds of upload integrating FileReference_List JavaScript class file.
 
For example in this page you can't see any Flash object, just a bit of JavaScript,
then just try to click on BROWSE FILE button and test its features.
 
Remember that this JS class requires a dedicated swf, a Flash Player 8 plugin and a javascript enabled browser.
 
Look at the example JS file to know more about FileReference or FileReferenceList interaction.
 
Here you can download dedicated FileReference_List.swf file.
 

 
Test this!
 
[ BROWSE FILE ]
 
<?php
// PHP 4 or greater example server-side file

// maximum size
$maxFileSize = 204800;
// upload folder with a 777 chmod
$uploadFolder = './uploaded_files/';

// some server side checks, these are really important
if(
	isset($_FILES['Filedata']) &&
	is_array($_FILES['Filedata']) &&
	isset(
		$_FILES['Filedata']['tmp_name'],
		$_FILES['Filedata']['name'],
		$_FILES['Filedata']['size'],
		$_FILES['Filedata']['error']
	)
) {
	$removeFile = '';
	// just for this example, if all is right or something is wrong
        // remove uploaded file or kill temporary upload
	if(
		intVal($_FILES['Filedata']['size']) <= $maxFileSize && 
		intVal($_FILES['Filedata']['error']) === 0 &&
		@move_uploaded_file(
			$_FILES['Filedata']['tmp_name'],
			$uploadFolder.$_FILES['Filedata']['name']
		)
	) {
		$removeFile = $uploadFolder.$_FILES['Filedata']['name'];
	}
	else
		$removeFile = $_FILES['Filedata']['tmp_name'];
	@unlink($removeFile);
	die();
}
?>