![]() |
file uploading - 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 uploading (/showthread.php?tid=55585) Pages:
1
2
|
file uploading - El Forum - 11-02-2012 [eluser]stv[/eluser] how to get the file name from a submitted form i used "$_FILES["banner"]["name"'];" " Message: Undefined index: banner " This error i got file uploading - El Forum - 11-02-2012 [eluser]noslen1[/eluser] Give some code please. You have something like that in your controller's method "do_upload()" (cf User Guide) : Code: if ( ! $this->upload->do_upload()) { Then you should retrieve the uploaded file name with : Code: $filename = $data['file_name']; file uploading - El Forum - 11-02-2012 [eluser]stv[/eluser] i want only the file name <input type="file" id="file_upload" name="banner"> in submit.php i wrote like these "$_FILES['banner']['name'];" i do not know why the error happens ” Message: Undefined index: banner ” file uploading - El Forum - 11-02-2012 [eluser]noslen1[/eluser] The error says you don't have 'banner' into your $_FILES array. So check out what data you got in your array Code: print_r($_FILES); file uploading - El Forum - 11-02-2012 [eluser]stv[/eluser] i applied your code "Array ( ) " this is the result.the file name is not in url also(i am using get method) file uploading - El Forum - 11-02-2012 [eluser]noslen1[/eluser] Please post your code, View and Controller, can't help you with eyes closed. file uploading - El Forum - 11-02-2012 [eluser]stv[/eluser] Quote:<form id="form" action="<?php echo base_url(); ?>index.php/backend/vehicle/addmodel/addmodels" method="get" autocomplete="off" enctype="multipart/form-data"> Quote:<?php file uploading - El Forum - 11-02-2012 [eluser]noslen1[/eluser] Think you can't upload a file with GET. Why are you using a GET method ? Do you really need it, because I don't see any advantage except for saving urls, to use GET method. Works great using POST method. Try it. file uploading - El Forum - 11-02-2012 [eluser]stv[/eluser] Code: Array ( [banner] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) [thumb] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) ) $_FILES['banner']['name']; use this also but nothing displaying file uploading - El Forum - 11-02-2012 [eluser]noslen1[/eluser] The code error 4 means that no file has been uploaded. (cf PHP Manual) |