I am sorry to repeat.But my problem is not solved.I will write down step by step,please someone correct me where am I committing the mistake.
1. I downloaded it from “http://devbro.com/testing/ci_form_validation/”.
2. I created a file called “MY_Form_validation” and saved it in the libraries folder where the “Form_validation.php” is kept.
3. I included this library in my controller like this
$this->load->library('MY_Form_validation');4. My controller looks like this,
$this->form_validation->set_rules("uploadedfile","File Upload","file_required|file_min_size[10KB]|file_max_size[500KB]|file_allowed_type[image]|file_image_mindim[50,50]|file_image_maxdim[400,300]");
5. My view look like this,
<tr>
<td><input type="hidden" name="MAX_FILE_SIZE" value="100000" /><label>
Select an Image to upload:</label></td>
<td><input name="uploadedfile" type="file"
<?php echo set_value('uploadedfile'); ?> id="uploadedfile"
/></td>
</tr>
<tr><td></td>
<div class="error"><?php echo form_error('uploadedfile'); ?></div>
</tr>
But when I submit my form without loading any file, it doesnot falling into
if ($this->form_validation->run() == FALSE){
$this->Addimage($productid);
}else {
$data['result']=$this->product_model->uploadimage($productid);
}it goes to else part instead.
Where am I doing the mistake ?
Any help regarding this will be extremely helpful to me as it will reduce many lines of unnecessary code.
Thanks.