/**
 * _check_photo对上传的照片进行处理
 * @access public
 * @return 返回照片名称
 */
function _check_photo()
{
    //类的实例化:
    include ROOT_PATH . "includes/upphoto.php";
    //类的文件名是upphoto.php
    $up = new upphoto();
    $up->get_ph_tmpname($_FILES['photo']['tmp_name']);
    $up->get_ph_type($_FILES['photo']['type']);
    $up->get_ph_size($_FILES['photo']['size']);
    $up->get_ph_name($_FILES['photo']['name']);
    echo $up->save();
    $temp = $up->get_ph_name($_FILES['photo']['name']);
    //提取出上传后生成的目录和文件名
    return $e_image = strrchr($up->get_ph_name($_FILES['photo']['name']), "/");
    //去掉目录,只保留文件名及后缀,方便存入数据库
}
Esempio n. 2
0
</script>
<?php 
//类的实例化:
$up = new upphoto();
$up->ph_path = $_SERVER['DOCUMENT_ROOT'] . "/";
//设定上传路径
$up->ph_name = $_FILES['photo1']['name'];
$submit = $_POST['submit1'];
if ($submit == "上传") {
    $up->get_ph_tmpname($_FILES['photo1']['tmp_name']);
    $up->get_ph_type($_FILES['photo1']['type']);
    $up->get_ph_size($_FILES['photo1']['size']);
    $up->get_ph_name($_FILES['photo1']['name']);
    $up->save();
}
$up = new upphoto();
$up->ph_path = $_SERVER['DOCUMENT_ROOT'] . "/";
//设定上传路径
$up->ph_name = $_FILES['photo']['name'];
$submit = $_POST['submit'];
if ($submit == "上传") {
    $up->get_ph_tmpname($_FILES['photo']['tmp_name']);
    $up->get_ph_type($_FILES['photo']['type']);
    $up->get_ph_size($_FILES['photo']['size']);
    $up->get_ph_name($_FILES['photo']['name']);
    $up->save();
}
?>

</div>