Codeigniter set_value not working - php

I'm querying the DB and sending sending a $data array from my controller to my view, where I'm using CI's form helper with set_value(field_name, default) but the data is not being loaded.
This is what I'm currently doing in my view:
<input type="hidden" id="artist-id" name="record_artist_id" value="<?php echo set_value('record_artist_id', $record_artist_id); ?>">
I thought I had to use the input helper so I tried:
<label for="record-name"><span class="required">*</span>Name:</label>
<?php
echo form_input([
'type' => 'text',
'name' => 'record_name',
'id' => 'record-name' ,
'class' => 'form-control',
'value' => set_value('record_name')
]);
?>
But still not working.
This is working though:
<input id="record-name" name="record_name" type="text" value="<?php echo (isset($record_name)) ? $record_name : ''; ?>" class="form-control">
The form helper is being loaded in autoload.php
$autoload['helper'] = array('url', 'file', 'form', 'base');
I don't know if this is related but I'm getting the view as a string and then passing it to a template, something like:
public function add_content($view, $content = NULL){
$this->content = $this->load->view($view, $content, TRUE);
return $this->content;
}
and later on in a different method:
// render content
$this->load->view('partials/content', ['content' => $this->content]);
Any idea about what I am doing wrong?

Try This
Controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
error_reporting(1);
class Welcome extends CI_Controller {
public function index()
{
$this->load->view('welcome_message');
}
public function test()
{
$this->load->helper('form','url');
$this->load->library("form_validation");
// echo "vijay";
$post=$this->input->post();
if($post)
{
// echo "<pre>";print_r($post);die;
$this->form_validation->set_rules('record_name', 'Record Name', 'trim|required');
$this->form_validation->set_rules('quantity', 'quantity Name', 'trim|required|numeric');
if($this->form_validation->run()==true)
{
redirect('/');
return 0;
}
}
$data['message']= validation_errors();
$this->load->view('test',$data);
}
}
View
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome to CodeIgniter</title>
</head>
<body>
<div id="container">
<h1>Welcome to CodeIgniter!</h1>
<div id="body">
</div>
<p>
<?= !empty($message) ? $message : '' ?>
</p>
<form method="post">
<label for="record-name"><span class="required">*</span>Name:</label>
<?php
$record_name_input = array('type' => 'text',
'name' => 'record_name',
'id' => 'record-name',
'class' => 'form-control',
'value' => set_value('record_name')
);
echo form_input($record_name_input);
?>
<h5>Username</h5>
<input type="text" name="quantity" value="<?php echo set_value('quantity', '0'); ?>" size="50" />
<?php
echo form_submit("submit", "submit data");
?>
</form>
</div>
</body>
</html>
Until you won't use $this->form_validation->run() til that set_value('field_name') won't work

Related

Bad Request (#400) in Yii2 when trying to login

I am getting Bad Request (#400) error while I am trying to login into a system. I am working on localhost.
Main layout:
<html lang="<?= Yii::$app->language ?>">
<head>
<meta charset="<?= Yii::$app->charset; ?>">
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1"/>
<?= Html::csrfMetaTags(); ?>
<title><?= Html::encode($this->title); ?></title>
<?php $this->head(); ?>
</head>
<body></body>
</html>
View (login.php):
<?php
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
$this->title = 'Login';
$this->params['breadcrumbs'][] = $this->title; ?>
<div class="container w-xxl w-auto-xs">
<a href class="navbar-brand block m-t">OpenXcell Pvt. Ltd.</a>
<div class="m-b-lg">
<div class="wrapper text-center">
<strong>Sign in to get in touch</strong>
</div>
<form action="/advanced/admin/site/login"
method="post"
name="form"
class="form-validation">
<div class="list-group list-group-sm">
<div class="list-group-item">
<input type="text" placeholder="Email" required
class="form-control no-border" name="username">
</div>
<div class="list-group-item">
<input type="password" placeholder="Password" required
class="form-control no-border" name="password">
</div>
</div>
<button type="submit" class="btn btn-lg btn-primary btn-block">
Log in
</button>
</form>
</div>
</div>
Site Controller:
<?php namespace backend\controllers;
use Yii;
use yii\filters\AccessControl;
use yii\web\Controller;
use app\models\LoginForm;
use yii\filters\VerbFilter;
class SiteController extends Controller {
public function behaviors() {
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'actions' => ['login', 'error'],
'allow' => true
],
[
'actions' => ['logout', 'index'],
'allow' => true,
'roles' => ['#']
]
]
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => ['logout' => ['post']]
]
];
}
public function actions() {
return ['error' => ['class' => 'yii\web\ErrorAction']];
}
public function actionIndex() {
return $this->render('index');
}
public function actionLogin() {
$model = new LoginForm();
if ($model->load(Yii::$app->request->post()) && $model->login()) {
return $this->goBack();
} else {
return $this->render('login', ['model' => $model]);
}
}
public function actionLogout() {
Yii::$app->user->logout();
return $this->goHome();
}
}
Model:
<?php namespace app\models;
use Yii;
use yii\base\Model;
class LoginForm extends Model {
public $username;
public $password;
public $rememberMe = true;
private $_user = false;
public function rules() {
return [
[['username', 'password'], 'required'],
['rememberMe', 'boolean'],
['password', 'validatePassword']
];
}
public function validatePassword($attribute, $params) {
if (!$this->hasErrors()) {
$user = $this->getUser();
if (!$user || !$user->validatePassword($this->password)) {
$this->addError($attribute, 'Incorrect username or password.');
}
}
}
public function login() {
$duration = $this->rememberMe ? 3600 * 24 * 30 : 0;
if ($this->validate()) {
return Yii::$app->user->login($this->getUser(), $duration);
} else {
return false;
}
}
public function getUser() {
if ($this->_user === false) {
$this->_user = User::findByUsername($this->username);
}
return $this->_user;
}
}
Why am I getting this error? What is wrong in my code?
Add CSRF token. If you don't want to use ActiveForm, then add this token explicitly (in case of ActiveForm is used, the token will be added automatically):
<form action="" method="post">
<input type ="hidden"
name ="<?php echo Yii::$app->request->csrfParam; ?>"
value="<?php echo Yii::$app->request->csrfToken; ?>">
</form>
To disable CSRF validation for the whole controller:
class DemoController extends Controller {
public $enableCsrfValidation = false;
}
To disable CSRF validation for a certain action:
class DemoController extends Controller {
public function beforeAction($action) {
if (in_array($action->id, ['example'])) {
$this->enableCsrfValidation = false;
}
return parent::beforeAction($action);
}
}
Also, read about security-passwords.
In cases where you have added the token:
<input type="hidden"
name="_csrf"
value="<?php echo Yii::$app->request->getCsrfToken() ?>">
And you are still having this issue, you need to add before the html tag:
<?php $this->beginPage() ?>
After the html tag in your layout files:
<?php $this->endPage() ?>
I finally figured this out after battling with the issue for almost a day.
Here is a sample layout file:
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
<meta charset="<?= Yii::$app->charset ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?= Html::csrfMetaTags() ?>
<title><?= Html::encode($this->title) ?></title>
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<?= $content ?>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
Just adding this will fix the issue:
class DemoController extends Controller {
public $enableCsrfValidation = false;
}
Hope this works for you!

Not able to insert into database using CodeIgniter

I am trying to insert data into database through Codeigniter, but I am not able to proceed. I have a database mydatabase with 5 tables training_assignment_id,assignment_name, assignment_description, recordings_required, and is_active. training_assignment_id is auto-increment.
Controller-1 training.php
<?php
class Training extends MY_Controller {
function __construct()
{
parent::__construct();
}
function index()
{
$this->load->helper(array('form'));
$this->load->view('training_admin');
}
/*
function input()
{
$this->load->model('training');
if($this->input->post('mysubmit')){
$this->training->training_assignment_insert();
}
}*/
}
?>
Controller-2 add_training.php
<?php
class Add_training extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->model('training');
}
/*function index($assignment, $description, $check, $radio)
{
$assignment=$this->input->post('assignment');
$description=$this->input->post('assignment2');
$check=$this->input->post('assignment3');
$radio=$this->input->post('is_active');
//query the database
if($assignment!=NULL || $description!=NULL || $check!=NULL || $radio!=NULL)
{
$this->training->training_assignment_insert($assignment, $description, $check, $radio);
echo 'inserted successfully';
}
else {
echo "Data has not been inserted";
}
}*/
function index()
{
$this->training->training_assignment_insert(); // this should forward them to the Model
}
}
?>
Model training.php
<?php
Class Training extends CI_Model
{
function __construct()
{
parent::__construct();
$this->load->database();
}
function training_assignment_insert($data ){
$data = array(
'assignment' => $this->input->post('assignment', TRUE),
'description' =>$this->input->post('assignment2', TRUE),
'check' => $this->input->post('assignment3', TRUE),
'radio' => $this->input->post('is_active', TRUE)
);
$this->db->insert('training_assignment', $data);
}
}
?>
View training_admin.php
<html>
<head>
<link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>resources/training/mystyle.css">
<title>Assignment</title>
</head>
<body>
<div id="container">
<h1>Add Assignment</h1>
<div id="body">
<?php echo form_open('traning/add_training'); ?>
<div id="label">
<input type="text" name="assignment" placeholder="Assignment Name" style="margin-left: 15px;"/>
<br/>
<textarea rows="4" cols="30" name="assignment2" placeholder="Assignment Description" style="margin-left: 15px;"></textarea>
<br/>
<label>Recording Require: </label>
<select name="assignment3">
<option value="1">Yes</option>
<option value="0">No</option>
</select>
<br/>
<label for="active">Enable </label>
<input type="radio" name="is_active" id="enable" value="1"/>
<label for="female">Disable </label>
<input type="radio" name="is_active" id="disable" value="0"/>
<br/>
<input class="class1" type="submit" value="Assign"/>
</div>
<p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds</p>
</div>
</div>
</form>
</body>
</html>
Please anyone help me I am new for the CodeIgniter.
do this
controller
<?php
class Add_training extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->model('training');
}
function index()
{
$insert = array(
'assignment' => $this->input->post('assignment', TRUE),
'description' =>$this->input->post('assignment2', TRUE),
'check' => $this->input->post('assignment3', TRUE),
'radio' => $this->input->post('is_active', TRUE)
);
$this->training->training_assignment_insert($insert); // this should forward them to the Model
}
}
?>
model
<?php
Class Training extends CI_Model
{
function __construct()
{
parent::__construct();
// $this->load->database();
}
function training_assignment_insert($data ){
$query = $this->db->insert('training_assignment', $data);
if($query){
return true;
}
}
}
?>
you need to pass post values to model try
controller
function index()
{
$data = array(
'assignment' => $this->input->post('assignment', TRUE),
'description' =>$this->input->post('assignment2', TRUE),
'check' => $this->input->post('assignment3', TRUE),
'radio' => $this->input->post('is_active', TRUE)
);
$this->training->training_assignment_insert($data); // this should forward them to the Model
}
and model :-
function training_assignment_insert($data ){
$this->db->insert('training_assignment', $data);
}

Unable to grab text from form_input

I am trying to obtain items that are within my view input boxes.
I am using:
$email = $this->input->post('email', true);
In order to obtain the what is within the input box. But it is not obtaining anything.
The function is run with:
<?php $function = array('auth/start', $price);?>
<form action="<?php echo base_url($function);?>"method="post">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_xZrfWwuBmwBzUBynB96OgZhU"
data-amount=""
data-name="Turbine Engine"
data-description="Individual Membership"
data-image="/128x128.png">
</script>
</form>
I have the following:
Controller:
function start()
{
$username = 'a';
$price = '100';
$password = 'password';
$email = $this->input->post('email');
$end = date('Y-m-d', strtotime('+1 years'));
$additional_data = array(
'first_name' => $this->input->post('first_name'),
'middle_initial' => $this->input->post('middle_initial'),
'last_name' => $this->input->post('last_name'),
'company' => $this->input->post('company'),
'phone' => $this->input->post('phone'),
'biography' => $this->input->post('biography'),
'address' => $this->input->post('address'),
'city' => $this->input->post('city'),
'state' => $this->input->post('state'),
'zip' => $this->input->post('zip'),
'position' => $this->input->post('position'),
'country' => $this->input->post('country'),
'website' => $this->input->post('website'),
'listing' => 'N',
'type' => 'I',
'registration_end' => $end,
);
//load payment library
$this->load->library( 'stripe' );
// Get the credit card details submitted by the form
$token = $_POST['stripeToken'];
// Create the charge on Stripe's servers - this will charge the user's card
try {
//attempt to charge user
$this->stripe->charge_card( intval($price), $token, "Individual Membership" );
}
catch(Stripe_CardError $e)
{
// The card has been declined
}
//If passed then add a new user
//add the user
$this->ion_auth->register($username, $password, $email, $additional_data);
$this->session->set_flashdata('message', 'Payment Successful');
//TEST
//load parameters
$type = 'new account';
$date = date('Y-m-d');
date_default_timezone_set('Australia/Melbourne');
$time = date('h:i:s a', time());
//load the controller for adding activity
$this->load->library('../controllers/activity');
$this->activity->insert($email, $type, $date, $time);
//send to login
//$this->showView('login');
redirect("auth", 'refresh');
}
View:
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="panel panel-default">
<div class="panel-body">
<!--Put Labels in order-->
<style>
label
{
display: inline-block;
width: 120px;
}
</style>
<h4>Individual Payment Page</h4>
<b>Make sure your email is correct</b>
<hr>
<p>
<?php echo form_label("Email:");?> <br />
<?php echo form_input(array('id' => 'email', 'name'=>'email','value'=>$email,'size'=>'30',
'readonly'=>'true'));?>
</p>
<!-- Make Hidden Labels to Pass the username and password-->
<p>
<?php echo form_input('username',$username);?>
<?php echo form_input('password',$password);?>
<?php echo form_input('first_name', $first_name);?>
<?php echo form_input('middle_initial',$middle_initial);?>
<?php echo form_input('last_name', $last_name);?>
<?php echo form_input('company', $company);?>
<?php echo form_input('phone', $phone);?>
<?php echo form_input('biography',$biography);?>
<?php echo form_input('address', $address);?>
<?php echo form_input('city', $city);?>
<?php echo form_input('state', $state);?>
<?php echo form_input('zip', $zip);?>
<?php echo form_input('position', $position);?>
<?php echo form_input('country', $country);?>
<?php echo form_input('website', $website);?>
</p>
<br>
<p>
<b>Click Below for Payment</b> <br>
</p>
<p><h4>1.) Regular Individual </h4><br>
<?php echo form_label("Price:");?> <br />
<?php echo form_input(array('name'=>'price','value'=>$price,'size'=>'30',
'readonly'=>'true'));?>
</p>
<?php $function = array('auth/start', $price);?>
<form action="<?php echo base_url($function);?>"method="post">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_xZrfWwuBmwBzUBynB96OgZhU"
data-amount=""
data-name="Turbine Engine"
data-description="Individual Membership"
data-image="/128x128.png">
</script>
</form>
<p><h4>2.) Regular Individual with Listing Enabled</h4><br>
<?php echo form_label("Price:");?> <br />
<?php echo form_input(array('name'=>'price_listing','value'=>$total,'size'=>'30',
'readonly'=>'true'));?>
</p>
<?php $function2 = array('auth/start_listing', $username, $password, $email, $first_name, $middle_initial, $last_name, $company, $phone, urldecode($address), $city, $state, $zip, urldecode($biography), $position, urldecode($country), urldecode($website), $total);?>
<form action="<?php echo base_url($function2);?>"method="post">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_xZrfWwuBmwBzUBynB96OgZhU"
data-amount=""
data-name="Turbine Engine"
data-description="Individual Membership"
data-image="/128x128.png">
</script>
</form>
</div>
</div>
</div>
</div>
</div>
Thank you. I appreciate any help.
In your view you have this:
//...
<?php echo form_input(array('id' => 'email', name'=>'email','value'=>$email,'size'=>'30', 'readonly'=>'true'));?>
//...
<form action="<?php echo base_url($function);?>"method="post">
// ...
</form>
But you didn't open the form before this input, so your inputs are not submitting, so open the form first like this:
echo form_open('url here');
echo form_input(array('id' => 'email', 'name'=>'email','value'=>$email,'size'=>'30', 'readonly'=>'true'));
//other inputs...
form_close();
The form_open opens/creates the opening form tag and form_close creates the closing form tag. You can also use <form> and </form> so put all your inputs inside the form before:
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button" ...></script>
Read more about Form Helper.
There is no any form_open() and form_close() in you input form. Please update your code this will solve your problem.
in order to post your text field you need to enclose it in a form tag
<input type="text" name="email" value="" />
<form action="someurl" method="post">
</form>
in this situation nothing will get posted to the server
if you need to post the text field you will need move it inside the form tags
<form action="someurl" method="post">
<input type="text" name="email" value="" />
</form>
or
form_open('someurl');
<?php echo form_label("Email:");?> <br />
<?php echo form_input(array('id' => 'email', name'=>'email','value'=>$email,'size'=>'30', 'readonly'=>'true'));?>
form_close();
make sure all the text filed are wraped inside a form

codeigniter - form submission mistake

i made a normal form for users to submit data name,email and city in form for this work i use some coding and i still not figure out where i mistaken please suggest.
routes
$route['default_controller'] = "welcome";
welcome.php in controller
public function index()
{
$this->load->view('ar_signup');
$this->load->helper('url');
}
}
ar_signup for the form in view
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Landing Page</title>
<meta charset="utf-8">
<link href="assests/css/ar/ar.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php echo validation_errors(); ?>
<?php echo form_open('user'); ?>
<label for="name">Name:</label>
<input type="name" id="name" name="name">
<label for="email">Email:</label>
<input type="email" id="email" name="email">
<label for="city">City:</label>
<input type="city" id="city" name="city">
<input type="submit" value="Login">
</div>
</form>
</body>
</html>
user.php in controller
<?php
function create_member()
{
$this->load->library('form_validation');
// field name, error message, validation rules
$this->form_validation->set_rules('name', 'Name', 'trim|required');
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
$this->form_validation->set_rules('city', 'City', 'trim|required');
if($this->form_validation->run() == FALSE)
{
$this->load->view('ar_thanks');
}
else
{
$this->load->model('users_model');
if($query = $this->Users_model->create_member())
{
$this->load->view('ar_landing');
}
}
}
user_model.php mention in models
<?php
function create_member()
{
$this->db->where('user_name', $this->input->post('username'));
$query = $this->db->get('users');
if($query->num_rows > 0){
}else{
$new_member_insert_data = array(
'name' => $this->input->post('name'),
'email' => $this->input->post('email'),
'city' => $this->input->post('city'),
);
$insert = $this->db->insert('users', $new_member_insert_data);
return $insert;
}
}//create_member
}
In Your user.php controller change
if($this->form_validation->run() == FALSE)
{
$this->load->view('ar_thanks');
}
to
if($this->form_validation->run() == FALSE)
{
$this->load->view('ar_signup');
}
In your view file give this: <?php echo form_open('user/create_member'); ?>
Now hit the ur: localhost/landingpage/index.php/user/create_member
If your controller is 'welcome' then your url should be 'localhost/welcome'. Also check your mod_rewrite.
Edit
I think it will be your php installation, since you said when you removed the php codes, it was working perfectly.

Error 500 after submitting the form in codeigniter

Using these MVC, I get Error 500. Any ideas?
Controller
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Download extends CI_Controller {
function __construct()
{
parent::__construct();
parent::__construct();
$this->load->library('form_validation');
$this->load->database();
$this->load->helper('form');
$this->load->helper('url');
$this->load->model('upload_model');
//$this->output->enable_profiler(TRUE);
}
function index()
{
$this->form_validation->set_rules('enter_product_name',
'Enter Product Name',
'required|max_length[200]');
$this->form_validation->set_rules('test_type',
'Test Type',
'required|max_length[200]');
$this->form_validation->set_rules('test_unit',
'Test Unit',
'required|max_length[200]');
$this->form_validation->set_rules('project_code',
'Project Code',
'required|max_length[200]');
$this->form_validation->set_error_delimiters('<br /><span class="error">',
'</span>');
if ($this->form_validation->run() == FALSE) // validation hasn't been passed
{
$data->page = 'download_form_view';
$this->load->view('container', $data);
// $this->load->view('upload_form_view');
}
else // passed validation proceed to post success logic
{
// build array for the model
$file_name_info = $this->input->post('enter_product_name')
.'_'. $this->input->post('test_type')
.'_'. $this->input->post('test_unit')
.'_'. $this->input->post('project_code');
$filename_data = array(
'download_name' => $file_name_info
);
// run insert model to write data to db
if ($this->download_model->DownloadName($filename_data) == TRUE)
{
//redirect('download/download');
$this->download();
}
else
{
echo 'An error occurred while saving your filename to database. Please contact Admin with Issue No.[1]';
// Or whatever error handling is necessary
}
}
}
function download()
{
$this->load->helper('download');
$this->db->select('download_name');
$this->db->where("id", "0");
$this->db->limit(1);
$query = $this->db->get('downloadname');
$download_save_name = $query->row()->download_name;
$data = file_get_contents("./uploads/$download_save_name.xlsx");
force_download("$download_save_name.xlsx", $data);
}
}
?>
View
<?php // Change the css classes to suit your needs
$attributes = array('class' => '', 'id' => ''); echo
form_open('download', $attributes); ?>
<p>
<label for="enter_product_name">Enter Product Name <span class="required">*</span></label>
<?php echo form_error('enter_product_name'); ?>
<br /><input id="enter_product_name" type="text" name="enter_product_name" value="<?php echo
set_value('enter_product_name'); ?>" /> </p>
<p>
<label for="test_type">Test Type <span class="required">*</span></label>
<?php echo form_error('test_type'); ?>
<?php // Change the values in this array to populate your dropdown as required ?>
<?php $options = array(
'' => 'Please Select',
'LongTerm' => 'Long Term Study',
'ShortTerm' => 'Short Term Study',
'Experimental' => 'Experimental Study',
); ?>
<br /><?php echo form_dropdown('test_type', $options, set_value('test_type'))?> </p>
<p>
<label for="test_unit">Test Unit <span class="required">*</span></label>
<?php echo form_error('test_unit'); ?>
<?php // Change the values in this array to populate your dropdown as required ?>
<?php $options = array(
'' => 'Please Select',
'Hyd' => 'Hyd Unit',
'Viz1' => 'Viz Unit-1',
'Viz2' => 'Viz Unit-2',
); ?>
<br /><?php echo form_dropdown('test_unit', $options, set_value('test_unit'))?> </p>
<p>
<label for="project_code">Project Code <span class="required">*</span></label>
<?php echo form_error('project_code'); ?>
<br /><input id="project_code" type="text" name="project_code" value="<?php echo set_value('project_code'); ?>" /> </p>
<p>
<?php echo form_submit( 'submit', 'Submit'); ?> </p>
<?php echo form_close(); ?>
Model
<?php
class Download_model extends CI_Model {
function __construct() { parent::__construct(); }
function DownloadName($filename_data)
{
$this->db->update('downloadname', $filename_data, "id = 0");
if ($this->db->affected_rows() == '1') { return TRUE; }
return FALSE; } } ?>
I think the problem is:
you loaded
$this->load->model('upload_model');
and in your model code you have given
class Download_model extends CI_Model {
change this to
class Upload_model extends CI_Model {

Categories