![]() |
File upload - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: File upload (/showthread.php?tid=57512) |
File upload - El Forum - 03-19-2013 [eluser]ninjayan[/eluser] I have a form which accepts user inputs and a file. I am not using the CI upload class and want to use the core php in uploading. My problem is when I check if the $_FILES is empty or not. I'm not sure why $_FILES is ignored in CI. Please have a look <code> <form acti echo base_url('documents/save_document'); ?>" id="new_document_form" class="forms" method="post" enctype="multipart/form-data"> <input type="file" name="attached_file" id="attached_file" accept="application/pdf" multiple> </form> ---- controller ---- if (!empty($_FILES['attached_file']['tmp_name'])) { $data['errors'] = 'a'; } else { $data['errors'] = 'b'; } </code> Here is my jquery form submit code <code> $('#new_document_form').on('submit', function(){ var save_form = $(this); alert(save_form.serialize() ![]() return false; }); </code> input:file value not showing in alert File upload - El Forum - 03-20-2013 [eluser]thebigpj[/eluser] <form acti echo base_url(‘documents/save_document’); ?>” id=“new_document_form” class=“forms” method=“post” enctype=“multipart/form-data”> Should that not be: <form acti echo base_url(‘documents/save_document’); ?>” ? |