[eluser]Linderman[/eluser]
Hell o!
So, the situation is like this:
View:
Code:
<?php echo form_open_multipart('admin/infopages/info'); ?>
<label>Infopage Title:</label><br />
<input type="text" name="title" value="" /><br />
<label>Infopage Content:</label><br />
<textarea name="content"></textarea><br />
<label>Infopage Image:</label><br />
<input type="file" name="thumbnail" value="" /><br />
<label>Meta Keywords:</label><br />
<textarea name="meta_keywords"></textarea><br />
<label>Meta Description:</label><br />
<textarea name="meta_description"></textarea><br />
<input type="submit" name="submit" value="Save" />
</form>
i am using multipart form!
in controller i am trying to say that input type='file' name='thumbnail' is required
Controller:
Code:
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('title', 'Title', 'required');
$this->form_validation->set_rules('thumbnail', 'Image', 'required');
f($this->form_validation->run() == FALSE){
$data['errors'] = TRUE;
} else {
$data['errors'] = FALSE;
... and here goes image uploading code (not important for this problem)...
}
The problem is when i CHOOSE image and click the submit button CI always says "The Image field is required." AND I AM SHURE ITS NOT EMPTY. Why is that?
When i use normal form NOT MULTIPART its ok , CI gives the message only when i really didnt choose a file to upload (normal). But when i use multipart form CI blows this message always no matter the field is empty or not ...
Please, Help guys!