MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Manual page 651

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

array_push($files, array('./images/'.$file, filectime('./images/
'.$file)));
}
usort($files, sorter);
if (count($files) > $MAXIMUM_FILE_COUNT) {
$files_to_delete = array_splice($files, 0, count($files) -
$MAXIMUM_FILE_COUNT);
for ($i = 0; $i < count($files_to_delete); $i++) {
unlink($files_to_delete[$i][0]);
}
}
print_r($files);
closedir($directory);
function sorter($a, $b) {
if ($a[1] == $b[1]) {
return 0;
} else {
return ($a[1] < $b[1]) ? -1 : 1;
}
}
?>
This PHP code first defines two constant variables:
$MAXIMUM_FILE_COUNT
image being uploaded to the server (200KB), as well as how many recently uploaded files
can be kept in the images folder (10). If the file size of the image currently being uploaded
is less than or equal to the value of
temporary folder.
Next, the file type of the uploaded file is checked to ensure that the image is a JPEG, GIF,
or PNG. If the image is a compatible image type, the image is copied from the temporary
folder to the images folder. If the uploaded file wasn't one of the allowed image types, it is
deleted from the file system.
Next, a directory listing of the image folder is created and looped over using a while loop.
Each file in the images folder is added to an array and then sorted. If the current number
of files in the images folder is greater than the value of
deleted until there are only
images folder from growing to an unmanageable size, as there can be only 10 images in
the folder at one time, and each image can only be 200KB or smaller (or roughly 2 MB of
images at any time).
3.
Save your changes to the PHP document.
4.
Upload the SWF, HTML, and PHP files to your web server.
. These variables dictate the maximum size (in kilobytes) of an
$MAXIMUM_FILESIZE
$MAXIMUM_FILE_COUNT
$MAXIMUM_FILESIZE
, the image is moved to the
$MAXIMUM_FILE_COUNT
images remaining. This prevents the
About file uploading and downloading
and
, files are
651

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?

This manual is also suitable for:

Flash 8

Table of Contents