Welcome Guest, Not a member yet? Register   Sign In
problem to Uploading and save image and video


I have to use CI_VERSION = '3.1.2';

I have to face problem to uploading video and images below is my code.

Controller file

PHP Code:
class Users extends CI_Controller
   function  __construct() {
    function add
//Check whether user upload picture
               $config = array();
           $config['upload_path'] = './uploads/';
           $config['allowed_types'] = 'gif|jpg|png';
           $config['max_size'] = '100';
           $config['max_width'] = '1024';
           $config['max_height'] = '768';
           $config['max_filename'] = '100';

                   $picture $uploadData['file_name'];

                   $picture 'nothing';
               $picture 'Noooo';
//Prepare array of user data
           $userData = array(
               'name' => $this->input->post('name'),
               'email' => $this->input->post('email'),
               'picture' => $picture
//Pass user data to model
           $insertUserData $this->user->insert($userData);
//Storing insertion status message.
               $this->session->set_flashdata('success_msg''User data have been added successfully.');
               $this->session->set_flashdata('error_msg''Some problems occured, please try again.');
       //Form for adding user data

Model file code 

PHP Code:
class User extends CI_Model{
   function __construct() {
       $this->tableName 'user';
       $this->primaryKey 'id';
function insert($data = array()){
           $data['created'] = date("Y-m-d H:i:s");
           $data['modified'] = date("Y-m-d H:i:s");
       $insert $this->db->insert($this->tableName,$data);
           return $this->db->insert_id();
           return false   

View File

PHP Code:
<?php echo $this->session->flashdata('success_msg'); ?>
echo $this->session->flashdata('error_msg'); ?>
<form role="form" method="post" enctype="multipart/form-data">
    <div class="panel">
        <div class="panel-body">
            <div class="form-group">
                <input class="form-control" type="file" name="picture" />
            <div class="form-group">
                <input class="form-control" type="text" name="name" />
            <div class="form-group">
                <input class="form-control" type="text" name="email" />
             <div class="form-group">
                <input type="submit" class="btn btn-warning" name="userSubmit" value="Add">

any changes need in config?

Please help me its urgent.

Thanks in advance.


What is the problem exactly ?
A good decision is based on knowledge and not on numbers. - Plato


Theme © iAndrew 2016 - Forum software by © MyBB