Welcome Guest, Not a member yet? Register   Sign In
Error when trying to upload image
#1

[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 ... ?
#2

[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
#3

[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');
...
#4

[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
#5

[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




Theme © iAndrew 2016 - Forum software by © MyBB