flash + php 文件上传
import flash.net.FileFilter;
import flash.net.FileReferenceList;
import fl.controls.Button;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.events.HTTPStatusEvent;
import flash.display.Loader;
import flash.net.URLRequest;
var choose_button:Button=new Button();
var upload_button:Button=new Button();
var loader:Loader=new Loader();
var reference_list:FileReferenceList=new FileReferenceList();
var url:URLRequest=new URLRequest("http://localhost/flashupload.php");
choose_button.label="选择文件";
upload_button.label="上传文件";
upload_button.move(100,50);
addChild(choose_button);
choose_button.move(300,100);
addChild(upload_button);
addChild(loader);
choose_button.addEventListener(MouseEvent.CLICK,choose_file);
upload_button.addEventListener(MouseEvent.CLICK,upload_start);
reference_list.addEventListener(Event.SELECT, selectHandle);
reference_list.addEventListener(Event.CANCEL, cancelHandle);
//reference_list.addEventListener(ProgressEvent.PROGRESS, progressHandler);
//reference_list.addEventListener(Event.COMPLETE, completeHandle);
//reference_list.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandle);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,load_complete);
function progressHandler(evt:ProgressEvent):void{
trace("ProgressEvent");
trace(evt.target.name+"="+evt.bytesLoaded)
}
function load_complete(evt:Event):void{
trace("load_complete");
}
function selectHandle(evt:Event):void{
trace("select file successfully");
trace("你选择了"+evt.target.fileList.length+"文件")
for(var i:int=0;i<evt.target.fileList.length;i++){
trace(evt.target.fileList[i].name);
evt.target.fileList[i].addEventListener(ProgressEvent.PROGRESS, progressHandler);
evt.target.fileList[i].addEventListener(Event.COMPLETE, completeHandle);
evt.target.fileList[i].load();
}
//trace("type"+evt.target.fileList[
相关文档:
很荣幸上篇文章被版主推荐到首页了,心里算是激动了一把,继续努力学习中吧。本章主要介绍PHP中的变量。主要包括:预定义变量、变量范围、可变变量以及PHP的外部变量等。
一、基础知识
PHP 中一个美元符号后面跟上一个变量名称,即表示一个变量。变量的名称是对大小写敏感的。
变量名与 PHP 中其它的标签一样遵循相同的 ......
getenv() 取得系统的环境变量(预定义变量)
$spager=getenv('SERVER_NAME');
“PHP_SELF”
当前正在执行脚本的文件名,与 document root 相关。举例来说,在 URL 地址为 [url]http://example.com/test.php/foo.bar[/url] 的脚本中使用 $_SERVER['PHP_SELF'] 将会得到 /test.php/foo.bar 这个结 ......
<?php
echo "<br>";
?>
<?php
function GetIP()
{
if(!empty($_SERVER["HTTP_CLIENT_IP"]))
$cip = $_SERVER["HTTP_CLIENT_IP"];
else if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
$cip = $_SERVER["HTTP_X_FORWARDED_FOR"];
else if(!empty($_SERVER ......
All metal heart shaped necklace containing an 8 GB USB flash drive.
These days a
USB flash drive
is as necessary as your house keys. Whether you are
taking large work files back and forth from the office or are sharing pictures
and music with friends, nothing beats the convenience of a USB ......
原帖地址:http://www.phpma.com/english/20071215/640.html
Description
array explode
( string separator, string string [, int limit])phpma.com
Returns an array of strings, each of which is a substring of string
formed by splitting it on boundaries formed by the string separator
. If limit
is ......