2
嘿,我想上传一个图像到我的资产文件夹。但我无法正确完成。实际上我想用名称保存图像“最后插入的ID”。 我不知道错误是什么。请帮我如何上传图像codeigniter
$.ajax({
url: base_url+"register/reg_submit/",
data: $('#career_submit_form').serialize(),//returns all cells' data
dataType: 'json',
type: 'POST',
success: function (res) {
alert(res.result)
},
在我的控制器reg_submit
$application_insert = $this->career->insert_student_application($personal_details,$parent_details,$other_details);
$config['upload_path'] = './application/assets/images/user_image/';
$config['allowed_types'] = 'jpg';
$config['file_name'] = $application_insert.'.jpg';
$this->load->library('upload', $config);
if (!$this->upload->do_upload('userfile'))
{
echo $this->upload->display_errors();
}
sry它不起作用。 –
你正在得到什么错误?你能够将图像名称存储在数据库中吗? – Ricky
我只是想保存图像与“最后插入id.jpg”作为名称到我的图像文件夹 –