[eluser]RaiNnTeaRs[/eluser]
Hi all,There are some sites,that required password to upload files. can someone give me code to upload files using authentication ?
$cek = $this->session->userdata('logged_in');
if ($cek != 'yes')
{
echo "Please Sign in first ^^";
$this->login();
}
else
{
$pv=$this->session->userdata('level');
if ($pv==100)
{
$config['upload_path'] '/storage/';
$config['allowed_types'] = 'gif|jpg|png|zip|rar|txt';
$config['max_size'] = '20000';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array ('error' => $this->upload->display_errors()
);
$this->load->view('upload_form',$error);
}
else
{
$data= array ('upload_data' => $this->upload->data()
);
$data['descrip']=$_POST['descrip'];
$this->load->view('upload_success',$data);
}
}
else
{
ECHO "SORRY , your cannot upload any files due to you level privilledge";
}
}
}
NB : THIS CODE ONLY WORK FOR MY LOCALHOST;PLEASE SEND ME A CODE FOR SOME SITES THAT REQUIRE PASSWORD AUTHENTICATION.