EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 650

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
650 Working with External Data
13. Select File > Publish settings and then select the Formats tab, and make sure that Flash and
HTML are both selected.
14. (Optional) In the Publish Settings dialog box, select the Flash tab, and then select Access
Network Only from the Local Playback Security pop-up menu.
If you complete this step, you wont run into security restrictions if you test your
document in a local browser.
15. In the Publish Settings dialog box, click Publish to create the HTML and SWF files.
When youre finished, go on to the next procedure, in which you create the container for
the SWF file.
You can find the sample source file for this example, FileUpload.fla, in the Samples folder on
your hard disk.
In Windows, browse to boot drive\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\ActionScript\FileUpload.
On the Macintosh, browse to Macintosh HD/Applications/Macromedia Flash 8/Samples
and Tutorials/Samples/ActionScript/FileUpload.
The following procedure requires that PHP is installed on your web server and that you have
write permissions to subfolders named images and temporary. You need to first complete the
previous procedure, or use the finished SWF file available in the previously noted folders.
To create a server-side script for the image upload application:
1. Create a new PHP document using a text editor such as Dreamweaver or Notepad.
2. Add the following PHP code to the document. (A code overview follows this script.)
<?php
$MAXIMUM_FILESIZE = 1024 * 200; // 200KB
$MAXIMUM_FILE_COUNT = 10; // keep maximum 10 files on server
echo exif_imagetype($_FILES['Filedata']);
if ($_FILES['Filedata']['size'] <= $MAXIMUM_FILESIZE) {
move_uploaded_file($_FILES['Filedata']['tmp_name'], "./temporary/
".$_FILES['Filedata']['name']);
$type = exif_imagetype("./temporary/".$_FILES['Filedata']['name']);
if ($type == 1 || $type == 2 || $type == 3) {
rename("./temporary/".$_FILES['Filedata']['name'], "./images/
".$_FILES['Filedata']['name']);
} else {
unlink("./temporary/".$_FILES['Filedata']['name']);
}
}
$directory = opendir('./images/');
$files = array();
while ($file = readdir($directory)) {

Table of Contents

Related product manuals