Welcome Guest, Not a member yet? Register   Sign In
File uploading: Optional fields?
#2

[eluser]LuckyFella73[/eluser]
Hi,

in your controller you can check if the user has selected
a file - for example:
Code:
if ( isset($_FILES['userfile_0']) AND strlen($_FILES['userfile_0']['name'])>0 )
{
# ok, the user has selected a file (input fild with name="userfile_0")
$config['upload_path'] = 'abc';
$config['allowed_types'] = 'abc';
$config['max_size']    = 'abc';

$this->load->library('upload');
$this->upload->initialize($config);

if ( ! $this->upload->do_upload($fieldname="userfile_0") )
{
# somthing wrong
}else
# file has beeing uploaded
}
}

You can extend this depending on how many files the user
is able to choose. So you would go on with "userfile_1",
"userfile_2" and so on.


Messages In This Thread
File uploading: Optional fields? - by El Forum - 01-25-2008, 07:41 AM
File uploading: Optional fields? - by El Forum - 01-25-2008, 07:58 AM
File uploading: Optional fields? - by El Forum - 01-29-2008, 02:02 PM
File uploading: Optional fields? - by El Forum - 01-30-2008, 03:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB