在codeigniter中调用MsSQL的上传SP

时间:2016-01-12 05:38:25

标签: php codeigniter

我需要你帮助我如何调用我在MsSQL中创建的存储过程,它是一个上传函数。

这是我目前在CI中的代码:

模型

function search($data){

    $qString="[gen048upload]";


    $this->db->query('set ansi_padding on
                        set ARITHABORT on
                        set CONCAT_NULL_YIELDS_NULL on
                        set QUOTED_IDENTIFIER on
                        set ANSI_NULLS on
                        set ANSI_WARNINGS on
                        set numeric_roundabort off');
    $query = $this->db->query($qString);    
    return ($query->num_rows() > 0) ? $query->result() : NULL;
}

我当前的控制器仅用于复制到其他目录,但现在是:

控制器

    function upgen048()
{

    $this->file_path = realpath(navi_ups.'/gen048');

    $config['upload_path'] = $this->file_path;
    $config['max_size'] = 0;
    $config['allowed_types'] = 'txt';
    $config['overwrite'] = TRUE;

    $this->load->library('upload');
    $this->upload->initialize($config);
    $this->upload->set_allowed_types('*');

    if ( !$this->upload->do_upload('uploadData'))
        {   
                $data['error'] = $this->upload->display_errors();
                $data['main_content'] = 'upgen048';
                $this->load->view('includes/template',$data);
        }
    else { //else, set the success message
                $data = array('msg' => "Upload success!");
                $data['main_content'] = 'upgen048';
                $this->load->view('includes/template',$data);
                $data['upload_data'] = $this->upload->data();

    }

0 个答案:

没有答案