CodeIgniter Forums
Upload file with ajax framework - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Upload file with ajax framework (/showthread.php?tid=62207)



Upload file with ajax framework - michalis - 06-19-2015

Hallo,
I am using ajax framework in my project ( https://github.com/bcit-ci/CodeIgniter/wiki/Ajax-Framework-For-CodeIgniter )
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 ???


RE: Upload file with ajax framework - PaulD - 06-22-2015

It is a bit old, but this TUTs might help

http://code.tutsplus.com/tutorials/how-to-upload-files-with-codeigniter-and-ajax--net-21684

Hope that is helpful for you, it helped me.