Skip to content

Instantly share code, notes, and snippets.

@chukitow
Created March 3, 2014 23:13
Show Gist options
  • Select an option

  • Save chukitow/9336642 to your computer and use it in GitHub Desktop.

Select an option

Save chukitow/9336642 to your computer and use it in GitHub Desktop.
$file_name = $_FILES['files']['name'];
$config['upload_path'] ='img/';
$config['allowed_types'] = 'gif|jpg|png|mp3|pdf|rar|zip';
$config['max_size'] = '0';
$config['max_width'] = '0';
$config['max_height'] = '0';
$config['overwrite'] = true;
$config['file_name'] = $file_name;
$this->load->library('upload',$config);
if (!$this->upload->do_upload('files'))
{
$errors = $this->upload->display_errors();
var_dump($errors);
}
else
{
echo json_encode(array('message' => $file_name, 'as'=>'as'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment