如果我使用绝对 url,我可以将图像上传到文件夹。但是如何使用绝对网址?
function do_upload()
{
$config['upload_path'] = 'upload/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->load->view('upload_success', $data);
}
}
以上是我的控制器代码。我尝试上传,但我无法判断文件夹应该位于哪个路径?它应该在根目录中还是在控制器中还是在视图中?