多文件上传

2019-04-15 12:40发布

    $pic=$_FILES['pic'];
    $path ="./upload/";
    
    foreach ($pic['name'] as $key => $value) {
        $data[$key]['name']=$pic['name'][$key];
        $data[$key]['tmp_name']=$pic['tmp_name'][$key];
        $data[$key]['size']=$pic['size'][$key];
        $data[$key]['error']=$pic['error'][$key];
        $data[$key]['type']=$pic['type'][$key];
        
    }
    foreach ($data as $key => $value) {
    move_uploaded_file($value['tmp_name'], $path.time().$value['name'].pathinfo($value['name'],PATHINFO_EXTENSION));
    }