【调度系统】广东民航医疗快线调度系统源代码
wzp
2025-05-14 a023d5daed320eb4dbf6cfb8c28529d41cf5f9c3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
$file = $_FILES["file"];
//echo $file["name"];
//exit;
//检证传进文件类型
$allowType=array("png", "gif", "jpg", "jpeg");
$imgType = strtolower(substr($file["name"],strrpos($file["name"],'.')+1));
if(!in_array($imgType, $allowType)){
    echo "非图片文件";
    exit;
}
//检验文件大小
$fileSize = $file["size"]; //图片大小
$maxsize=2000 * 1024; //最大文件大小
if($fileSize > $maxsize){
    echo "文件过大";
    exit;
}
 
//修改文件名 以时间戳命名
$randname=date("Y").date("m").date("d").date("H").date("i").date("s").rand(100, 999).".".$imgType;
//检验文件是否是通过HTTP POST上传
if(is_uploaded_file($file["tmp_name"])){ 
    $filepath = '../UserPhoto/';//保存文件路径
    move_uploaded_file($file["tmp_name"],$filepath.$randname);
    $randname1 = "https://api.966120.com.cn/UserPhoto/".$randname;
    $return = array(
        "SnsImg" => $randname1,
        "result" => "1"
    );
    echo $randname1;
}else{
    exit;
}
?>