CodeIgniter Forums

Full Version: Upload file with ajax framework
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hallo,
I am using ajax framework in my project ( https://github.com/bcit-ci/CodeIgniter/w...odeIgniter )
I would like to upload an image from a form.

when i put this code in controller with name users image upload correct but i want to put my code in ajax controller in file response/users
my code to upload image.

$config['upload_path'] = './assets/images/avatars/' . $user_id ;
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '800';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$config['file_name'] = 'avatar.png';

$this->load->library('upload', $config);

if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());

}
else
{
$data = array('upload_data' => $this->upload->data());
}

Any help ???
It is a bit old, but this TUTs might help

http://code.tutsplus.com/tutorials/how-t...-net-21684

Hope that is helpful for you, it helped me.