将图像保存在物理路径Aspx中

时间:2017-09-13 13:54:52

标签: asp.net iis virtual

我的.aspx页面中有一个telerik:RadAsyncUpload 我有一个虚拟目录DATA_INTRANET映射到C:\ DATA_INTRANET \ ImgProd

我想将RadAsynUpload上传的图像保存在目录C:\ DATA_INTRANET \ ImgProd

public function profile()
    {
        $data['userdata'] = $this->usermodel->get_user($this->session->userdata('id'));
        $this->load->view('edit-profile1',$data);
    }

public function update()
{
    $user = new Users_model(); 
    // $user->phone1 = $this->input->post('phone1');
    $user->account_status = 1;
    //session data
    $user->id = $this->session->userdata('id');
    $user->password = $this->session->userdata('password');
    $user->username = $this->session->userdata('username');
    $user->email = $this->session->userdata('email');
    $user->user_role = $this->session->userdata('user_role'); 
    $image_type=$_FILES['image']['type'];
    $image_name=$user->id . $image_type;
    //id to be set
    $id = $user->id; 

    $config['upload_path'] = 'media/images/users';
    $config['allowed_types'] = 'jpg|jpeg|png|gif';
    $config['overwrite'] = TRUE;
    $config['file_name'] = $image_name;

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

    if (!$this->upload->do_upload('image')) {
        $this->upload->display_errors('<span>', '</span>');
        $data['error'] = $this->upload->display_errors();
    } else {
        $file_data = $this->upload->data();
        $data['success'] = "Your file is uploaded";
    }

    $res = $this->db->update('users', $user, array('id' => $id));
    $URL = base_url() . "users/profile/";
    redirect($URL, "refresh"); 
}

请帮助

0 个答案:

没有答案