[eluser]learning_php[/eluser]
Hi,
i had an image upload function working on my localhost but when i put in on the server it gives me a error:
Code:
The upload path does not appear to be valid.
]
controller
Code:
function upload()
{
// Image configuration
$config['upload_path'] = 'uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['overwrite'] = FALSE;
$config['max_size'] = 4048;
$this->load->library('upload', $config);
if(!$this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('upload', $error);
}
else
{
$image = $this->upload->data();
$data['image'] = "uploads/".$image['file_name'];
$config['image_library'] = 'gd2';
$config['source_image'] = $data['image'];
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 150;
$config['height'] = 150;
$config['new_image'] = "thumbs/".$image['file_name'];
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$data = array('upload_data' => $this->upload->data());
$this->load->view('upload_suc', $data);
}
}
view
Code:
<!DOCTYPE HTML>
<html>
<head>
<title>Uploader</title>
</head>
<body>
<?= form_open('gallery/logout')?>
<input type="submit" value="Logout" />
<?=form_close();?>
<?php echo $error;?>
<?php echo form_open_multipart('uploadimg/upload');?>
<input type="file" name="userfile" size="20" />
<br /><br />
<input type="submit" value="upload" />
</form>
</body>
</html>