多文件上传 怎么弄 ?

浏览:728 发布日期:2013/12/12 分类:求助交流 关键字: 多文件
我有4个上传表单,如果全部选择文件,可以上传。 但是选择的不是4个的时候 没有选择的那个表单报错

代码如下:        $upload = new upload();
        $info = $upload->upload();
        if($info){
                $updoc0 = __ROOT__ . '/' . $info[0]['path'];
                $updoc1 = __ROOT__ . '/' . $info[1]['path'];
                $updoc2 = __ROOT__ . '/' . $info[2]['path'];
                $updoc3 = __ROOT__ . '/' . $info[3]['path'];
        }
        $data = array(
                'wid'         => $this->_POST('wid', 'intval'),
                'title'         => $this->_POST('Title'),
                'file0'        => isset($updoc0) ? $updoc0 : '',
                'file1'        => isset($updoc1) ? $updoc1 : '',
                'file2'        => isset($updoc2) ? $updoc2 : '',
                'file3'        => isset($updoc3) ? $updoc3 : '',
                'uid'    => $_SESSION['uid'],
                'time'         => time(),
                );
    p($data);die;
表单:<input name="updoc0" type="file" />
<input name="updoc1" type="file" />
<input name="updoc2" type="file" />
<input name="updoc3" type="file" />
错误代码:

最佳答案
评论( 相关
后面还有条评论,点击查看>>