Welcome Guest, Not a member yet? Register   Sign In
Re-populating Input file after validation
#1

[eluser]Salim[/eluser]
Hi,

I'm using CI validation with MY_form_helper.php.

In my form, I have an
Code:
input type="file"
.
To generate it, I have modified the helper MY_form_helper, adding this function to generate the input file.

Code:
function form_input_file($data = '', $value = '', $extra = '')
{
    $name = ( ! is_array($data))?$data:((isset($data['name']))?$data['name']:'');
    $value = (isset($_POST[$name]))?$_POST[$name]:((isset($_GET[$name]))?$_GET[$name]:$value);
    $defaults = array('type' => 'file', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value, 'maxlength' => '500', 'size' => '50');

    return "<input ".parse_form_attributes($data, $defaults).$extra." />\n";
}

I just have modified the 'type' => 'file'...

Unfortunately, after validation, the value of the input file is not saved ...

Does anyone have a solution ??

Thanks in advance,


Messages In This Thread
Re-populating Input file after validation - by El Forum - 05-16-2008, 02:27 AM
Re-populating Input file after validation - by El Forum - 05-16-2008, 02:41 AM
Re-populating Input file after validation - by El Forum - 05-16-2008, 03:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB