AJAX 客户端页面代码: index.html
复制代码 代码如下:
<>
PHP服务器端代码: upload.php
复制代码 代码如下:
// $_FILES['photofile']:是获得上传图片的数组
// $uploadfile:存放地址
$uploadfile = "D:/".$_FILES['photofile']['name'];
copy( $_FILES['photofile']['tmp_name'], $uploadfile );
echo "URL: ".$_FILES['photofile']['name']."
";
?>
Upload successed!
复制代码 代码如下:
Ajax file upload sample
<>
PHP服务器端代码: upload.php
复制代码 代码如下:
// $_FILES['photofile']:是获得上传图片的数组
// $uploadfile:存放地址
$uploadfile = "D:/".$_FILES['photofile']['name'];
copy( $_FILES['photofile']['tmp_name'], $uploadfile );
echo "URL: ".$_FILES['photofile']['name']."
";
?>
Upload successed!
关键字词: