나는 3 일간의 검색을 마치고 지쳤다. 누군가가 내게 말하면 이미지로 텍스트를 업로드하는 방법을 보여줄 수 있는가?codeigniter 양식
public function add()
{
$subject = array(
'name' => $this->input->post('name'),
'lastname' => $this->input->post('lastname'),
'position' => $this->input->post('position'),
'pass_id' => $this->input->post('pass_id')
);
$this->main_model->add($subject);
$this->index();
}
와 모델 파일 :
my table:
name -> varchar
lastname -> varchar
position -> varchar
pass_id -> int
image_url -> varchar
이
이이 컨트롤러 파일입니다<h2>Create</h2>
<?php echo form_open('main/add'); ?>
<p>
<label for="name">Name:</label>
<input type="text" name="name" id="name" />
</p>
<p>
<label for="lastname">Lastname:</label>
<input type="text" name="lastname" id="lastname" />
</p>
<p>
<label for="position">Position:</label>
<input type="text" name="position" id="position" />
</p>
<p>
<label for="name">Passport ID:</label>
<input type="text" name="pass_id" id="pass_id" />
</p>
<input type="file" name="userfile" size="20" />
<input type="submit" value="Submit" />
<?php echo form_close(); ?>
form_view의 파일에 이미지 URL을 업로드하는 방법
public function add($object)
{
$this->db->insert('stuf', $object);
return;
}
db.
저는 CI에서 초보자입니다. thanks
덕분에 당신의 주의. 코드가 작동하지 않습니다. 코드를 코드화하려고합니다. 내가 할 수 있으면 여기에 게시 할 것입니다. – vkatsitadze