file upload + jquery - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: file upload + jquery (/showthread.php?tid=49715) |
file upload + jquery - El Forum - 02-29-2012 [eluser]ibnclaudius[/eluser] I'm trying to upload an image using jquery, but always getting the "echo 'fail';". I'm also using JQuery Ajax Form plugin: http://jquery.malsup.com/form/ My code: Code: <form id="new-update-attach-image-form" method="post" action="<?php echo site_url(); ?>/form/upload_school_update_image" enctype="multipart/form-data"> Code: public function upload_school_update_image() Code: newUpdateAttachImageOptionsUploadBox.change(function () file upload + jquery - El Forum - 02-29-2012 [eluser]CroNiX[/eluser] instead of just echoing 'fail', how about echoing the error(s)? Code: echo $this->upload->display_errors(); file upload + jquery - El Forum - 02-29-2012 [eluser]ibnclaudius[/eluser] Quote:You did not select a file to upload. file upload + jquery - El Forum - 02-29-2012 [eluser]CroNiX[/eluser] Try giving your file element a 'name' attribute. file upload + jquery - El Forum - 02-29-2012 [eluser]ibnclaudius[/eluser] Thanks, that worked! file upload + jquery - El Forum - 02-29-2012 [eluser]ibnclaudius[/eluser] I'm trying to get the file name, but no success Code: echo $this->upload->data('file_name') file upload + jquery - El Forum - 02-29-2012 [eluser]CroNiX[/eluser] upload->data() returns an array file upload + jquery - El Forum - 02-29-2012 [eluser]ibnclaudius[/eluser] How I get a ke tisnide of it? Should echo $this->upload->data('file_name') not work? file upload + jquery - El Forum - 02-29-2012 [eluser]CroNiX[/eluser] Code: $file_data = $this->upload->data(); |