![]() |
CodeIgniter V 2.0.2 Image Upload problem - 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: CodeIgniter V 2.0.2 Image Upload problem (/showthread.php?tid=44315) |
CodeIgniter V 2.0.2 Image Upload problem - El Forum - 08-10-2011 [eluser]Manjunath Reddy[/eluser] Dear All, I am facing problem with uploading image. CodeIgniter Version = 2.0.2, I load the Upload library and my upload form code does not even call the Upload method do_upload. here is my source code. Code: <?php My View Code: <form name="form1" action="uploadtest" method="post" enctype="multipart/form-data"> Here is the debug code I have included in the system/Upload.php Code: public function do_upload($field = 'userfile') If Im not wrong, why they force to use "userfile" as name in <input type='file' name='userfile'> what If I have to give different name? :-) is there an example for CI V2.0.2, I could follow up. Is there something wrong with CI 2.0.2, Uploading API CodeIgniter V 2.0.2 Image Upload problem - El Forum - 08-11-2011 [eluser]StefanAlexandru[/eluser] Hi, I think your problem is that you are not calling the method inside controller. Try to use form helper and open your form like this: form_open_multipart('upload/do_upload');?> Or change the action of your form like this: controller/function instead of "uploadtest" CodeIgniter V 2.0.2 Image Upload problem - El Forum - 08-11-2011 [eluser]Manjunath Reddy[/eluser] Hi Stefan, Thanks for your reply :-), I appreciate that. First thing I'm calling the do_upload inside the controller itself :-). Secondly, Code: <form name="form1" action="uploadtest" method="post" enctype="multipart/form-data"> Here my form action directly pointing to Controller's('Uploadtest') index function, I guess I do not need to do controller/function right :-). CodeIgniter V 2.0.2 Image Upload problem - El Forum - 08-11-2011 [eluser]StefanAlexandru[/eluser] Why don't you just try uploadtest/index .. Anyway sorry for the first reply... I am on my phone right now.. So maybe that's why I didn't pay attention to your entire post. CodeIgniter V 2.0.2 Image Upload problem - El Forum - 08-11-2011 [eluser]LuckyFella73[/eluser] Your controller should more look like this: Code: <?php In your form-action I would better set this: Code: <form name="form1" action="<?php echo site_url();?>/uploadtest" method="post" enctype="multipart/form-data"> CodeIgniter V 2.0.2 Image Upload problem - El Forum - 08-11-2011 [eluser]Manjunath Reddy[/eluser] Hi All, Thank you very much for you time, Its really helpful. after combining above logic's, manage to run it. :-). Really appreciate your time. Thumbs up. |