CodeIgniter Forums
Error when trying to upload image - 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: Error when trying to upload image (/showthread.php?tid=17079)



Error when trying to upload image - El Forum - 03-25-2009

[eluser]PermanaJ[/eluser]
I try to upload an image file .. when I select the image via the file input box, and submit the form ... there are error message saying that No file selected ... does anyone had face this problem before ... ?


Error when trying to upload image - El Forum - 03-25-2009

[eluser]vitoco[/eluser]
did you match the file-input name in the form and the name you're searching in the controller ??? , cause CI comes with a default name , so you need to change it or user the default in the form


Error when trying to upload image - El Forum - 03-25-2009

[eluser]PermanaJ[/eluser]
Do you mean $this->upload->do_upload('file_input_name') ? Yes I provide file input name ...

some of my code :
Code:
if($this->input->post('my_photo')){
if($this->upload->do_upload('my_photo') == false){
  $upload_error = $this->upload->display_errors();
  $this->data['message'] = '<div class="error">'.strip_tags($upload_error).'</div>';
  $this->template->display('form/addproduct', $this->data);
  return false;
}else{
  $photo = $this->upload->data();
  $this->data['content'] = '<div class="success">'.$photo.'</div>';
  }
}

...
$person['name']    = $this->input->post('name');
$person['address']= $this->input->post('address');
$person['phone']= $this->input->post('phone');
...



Error when trying to upload image - El Forum - 03-25-2009

[eluser]vitoco[/eluser]
can you post your form ??? , and i'm not sure if you can ask for file-input in post, cause i know they are store in $_FILE array


Error when trying to upload image - El Forum - 03-25-2009

[eluser]PermanaJ[/eluser]
heres the link to the original code ...

controller : http://permanaonline.googlepages.com/product.txt
view : i store all the form view on folder views/form/ http://permanaonline.googlepages.com/addproduct.txt