时间:2021-07-01 10:21:17 帮助过:21人阅读
windows下的路径要这样:D:\\WebService\\doc.juren9.com\\uploads\\房间阿斯顿.zipLinux:# /WebService/doc.juren9.com/uploads/房间阿斯顿.zip.gz
------解决方案--------------------
/*** 功能:*   上传图片* 参数说明:*   $imgpath:    FILE变量* 返回值:*   1:$imgpath   上传图片成功后的完整图片路径*   2:false      上传图片失败*   2:false      上传图片失败失败* 版本:*   v1.0 07年8月5日作第1次修改,*/  function upload_image($imgpath){           $name=$imgpath["name"];    $tmp_name=$imgpath["tmp_name"];    $type=$imgpath["type"];    $size=$imgpath["size"];    $uploadfile = "../index/upload_image/".$imgpath['name'];   //time()."_".   上传的位置           $maxsize=500*1024;                                           //最大允许上许文件大小    if($name==""){                                             //文件名为空         echo"";    }        if($size>$maxsize){                                       //超过规定大小             echo"";        exit;    }         if(move_uploaded_file($tmp_name,$uploadfile))         return $uploadfile;    else if (copy($tmp_name,$uploadfile))        return $uploadfile;    else        return false;    }//upload_image函数部分 在伱需要上传图片的页面调用这个函数 //如果不是一个页面 别忘记在那个页面包含这个文件    $photo=$_FILES['photo'];  upload_image($photo);?>
------解决方案--------------------
重复名  就行  吧