我在尝试在我的应用程序中实现 Codeigniter 类时遇到问题。问题是当我提交表单时,执行的函数没有将文件保存到我指定的文件夹中,也没有抛出错误消息。我的代码如下:
看法:
<?php echo form_open_multipart('requests/submit_candidate'); ?>
<table>
<tr>
<td><label for="text">Upload CV</label></td>
<td><input type="file" name="file"></textarea></td>
</tr>
<tr>
<td><label for="text">Extra Information</label></td>
<td><textarea name="extra_info"></textarea></td>
</tr>
</table>
<input type="submit" name="submit" value="Submit" />
</form>
控制器:
public function submit_candidate($slug)
{
$this->load->library('upload');
$config = array(
'upload_path' => dirname($_SERVER["SCRIPT_FILENAME"])."/uploads/",
'upload_url' => base_url()."uploads/",
'allowed_types' => "gif|jpg|png|jpeg|pdf|doc|xml",
'overwrite' => TRUE,
'max_size' => "1000KB",
'max_height' => "768",
'max_width' => "1024"
);
if($this->upload->do_upload($config))
{
echo "file upload success";
}
else
{
echo "file upload failed";
}
}
有人可以帮忙吗?
非常感谢,
SR