输入banner图图片脚本导航/分类

[代码]PHP上传图片简单实现

  以下程序使用move_uploaded_file函数上传图片到程序目录中,图片以temp_为前缀。

以下是代码片段:


PHP上传图片简单实现 www.cncms.com.cn


if($_GET[https://www.gxlcms.com/’actionhttps://www.gxlcms.com/’] == https://www.gxlcms.com/’upfilehttps://www.gxlcms.com/’)
{
$target_path = https://www.gxlcms.com/’temp_https://www.gxlcms.com/’.$_FILES[https://www.gxlcms.com/’photohttps://www.gxlcms.com/’][https://www.gxlcms.com/’namehttps://www.gxlcms.com/’];
echo https://www.gxlcms.com/’上传的临时文件:https://www.gxlcms.com/’ .$_FILES[https://www.gxlcms.com/’photohttps://www.gxlcms.com/’][https://www.gxlcms.com/’tmp_namehttps://www.gxlcms.com/’] . https://www.gxlcms.com/’
https://www.gxlcms.com/’;
echo https://www.gxlcms.com/’上传的目标文件:https://www.gxlcms.com/’ .$target_path . https://www.gxlcms.com/’
https://www.gxlcms.com/’;
echo $_SERVER["SCRIPT_FILENAME"] . https://www.gxlcms.com/’
https://www.gxlcms.com/’;
echo $_SERVER["OS"] . https://www.gxlcms.com/’
https://www.gxlcms.com/’;
//测试函数: move_uploaded_file
//也可以用函数:copy
move_uploaded_file($_FILES[https://www.gxlcms.com/’photohttps://www.gxlcms.com/’][https://www.gxlcms.com/’tmp_namehttps://www.gxlcms.com/’], $target_path);
echo "Upload result:";
if(file_exists($target_path)) {
if($_SERVER["OS"]!="Windows_NT"){
 @chmod($target_path,0604);
}
echo https://www.gxlcms.com/’Succeed!
https://www.gxlcms.com/’;
} else {
echo https://www.gxlcms.com/’Failed!https://www.gxlcms.com/’;
}
exit;
}
?>

Registration




技术交流 永无止境