日期:2014-05-17 浏览次数:20494 次
<?php
session_start();
require_once('pic_fns.php');
include("upload.class.php");
$edit_me = $_POST['edit_me']; //checkbox选中的数据储存在 edit_me数组中
$valid_user = $_SESSION['valid_user']; //检测是否登录
do_html_header("上传图片广告 Upload pic for machine");
try{
check_valid_user(); //检测是否登录
}catch(Exception $e){
echo $e->getMessage();
do_html_url('login_admin.php','返回');
do_html_footer();
exit;
}
foreach ($edit_me as $k){ //循环上传图片,提交后显示WARNING foreach的数据为空
if($_POST['submit']){ //图片上传部分
$image = new upload_image();
$image->get_file_dir("pic/".$k."/"); //文件存放目录
$image->get_upload_name($_FILES['file']['name']);
$image->get_upload_size($_FILES['file']['size']);
$image->get_upload_type($_FILES['file']['type']);
$image->get_upload_tamp($_FILES['file']['tmp_name']);
$image->upload();
display_user_menu();
do_html_footer;
}
}
?>
<form action="" method="post" enctype="multipart/form-data">
<table align="center">
图片来源:<input type="file" name="file">
<input type="hidden" name="hidden" value="a">
<input type="submit" name="submit" value="上传">
</table>
</form><br />
<?php
display_user_menu();
do_html_footer;
?>