file uploading |
[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
[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'];
[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 ”
[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);
[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)
[eluser]noslen1[/eluser]
Please post your code, View and Controller, can't help you with eyes closed.
[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
[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.
[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
[eluser]noslen1[/eluser]
The code error 4 means that no file has been uploaded. (cf PHP Manual) |
Welcome Guest, Not a member yet? Register Sign In |