• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
$_FILES Array getting empty when using $this->form_validation->run()

#21
(06-12-2019, 03:51 AM)hc-innov Wrote: is it the right value (the right id inserted and not 0) ?

Yes. Property details table has a record with id 24, Thats correct value.
Reply

#22
step by step...
Change your model and return the last_inserted_id.
In your controller, change this part of code to:

PHP Code:
if($this->form_validation->run())
 
          {
 
              $prop_title ucwords(strtolower($this->security->xss_clean($this->input->post('prop_title'))));
 
              $prop_status ucwords(strtolower($this->security->xss_clean($this->input->post('prop_status'))));
 
              $prop_type ucwords(strtolower($this->security->xss_clean($this->input->post('prop_type'))));
 
              $prop_price $this->security->xss_clean($this->input->post('prop_price'));
 
              $prop_sqft $this->security->xss_clean($this->input->post('prop_sqft'));
 
              $prop_rooms $this->security->xss_clean($this->input->post('prop_rooms'));
 
              $prop_address $this->security->xss_clean($this->input->post('prop_address'));
 
              $prop_owner_name $this->security->xss_clean($this->input->post('prop_owner_name'));
 
              $prop_owner_email $this->security->xss_clean($this->input->post('prop_owner_email'));
 
              $prop_owner_phone $this->security->xss_clean($this->input->post('prop_owner_phone'));
 
              $prop_detailed_info $this->security->xss_clean($this->input->post('prop_detailed_info'));
 
              $prop_current_status $this->security->xss_clean($this->input->post('prop_current_status'));
 
               $propertyInfo = array('title'=>$prop_title'status'=>$prop_status'type'=>$prop_type'price'=>$prop_price,
 
                                     'sqft'=>$prop_sqft'rooms'=>$prop_rooms'address'=>$prop_address'name'=>$prop_owner_name,
 
                                     'email'=>$prop_owner_email'phone'=>$prop_owner_phone'detailedInfo'=>$prop_detailed_info,
 
                                     'currentStatus'=>$prop_current_status);
 
              $result $this->property_model->addNewProperty($propertyInfo);
echo 
$result.'<br>';
 
              if (!empty($_FILES)) {
 
                  $count_img count($_FILES['file']['name']);
 
                  foreach($_FILES['file']['tmp_name'] as $key => $value) {

 
                   $tempFile $_FILES['file']['tmp_name'][$key];
 
                   $fileName $_FILES['file']['name'][$key];
 
                   $targetPath 'property-images/';
 
                   $targetFile $targetPath $fileName ;

 
                   //$this->load->model('user_model');

 
                   $imgData = array('path'=>$targetFile,'propertyid'=>$result);

 
                   if(move_uploaded_file($tempFile$targetFile))
 
                   {
 
                       echo 'Move upload file and add propertyImgs<br>';
 
                       $this->property_model->addPropertyImgs($imgData);
 
                   }
 
                  }
 
              } else {
 
                  echo '$_FILES is empty';
 
              }
die();
 
            
and post the result
Reply

#23
(06-12-2019, 04:06 AM)hc-innov Wrote: step by step...
Change your model and return the last_inserted_id.
In your controller, change this part of code to:

PHP Code:
if($this->form_validation->run())
 
          {
 
              $prop_title ucwords(strtolower($this->security->xss_clean($this->input->post('prop_title'))));
 
              $prop_status ucwords(strtolower($this->security->xss_clean($this->input->post('prop_status'))));
 
              $prop_type ucwords(strtolower($this->security->xss_clean($this->input->post('prop_type'))));
 
              $prop_price $this->security->xss_clean($this->input->post('prop_price'));
 
              $prop_sqft $this->security->xss_clean($this->input->post('prop_sqft'));
 
              $prop_rooms $this->security->xss_clean($this->input->post('prop_rooms'));
 
              $prop_address $this->security->xss_clean($this->input->post('prop_address'));
 
              $prop_owner_name $this->security->xss_clean($this->input->post('prop_owner_name'));
 
              $prop_owner_email $this->security->xss_clean($this->input->post('prop_owner_email'));
 
              $prop_owner_phone $this->security->xss_clean($this->input->post('prop_owner_phone'));
 
              $prop_detailed_info $this->security->xss_clean($this->input->post('prop_detailed_info'));
 
              $prop_current_status $this->security->xss_clean($this->input->post('prop_current_status'));
 
               $propertyInfo = array('title'=>$prop_title'status'=>$prop_status'type'=>$prop_type'price'=>$prop_price,
 
                                     'sqft'=>$prop_sqft'rooms'=>$prop_rooms'address'=>$prop_address'name'=>$prop_owner_name,
 
                                     'email'=>$prop_owner_email'phone'=>$prop_owner_phone'detailedInfo'=>$prop_detailed_info,
 
                                     'currentStatus'=>$prop_current_status);
 
              $result $this->property_model->addNewProperty($propertyInfo);
echo 
$result.'<br>';
 
              if (!empty($_FILES)) {
 
                  $count_img count($_FILES['file']['name']);
 
                  foreach($_FILES['file']['tmp_name'] as $key => $value) {

 
                   $tempFile $_FILES['file']['tmp_name'][$key];
 
                   $fileName $_FILES['file']['name'][$key];
 
                   $targetPath 'property-images/';
 
                   $targetFile $targetPath $fileName ;

 
                   //$this->load->model('user_model');

 
                   $imgData = array('path'=>$targetFile,'propertyid'=>$result);

 
                   if(move_uploaded_file($tempFile$targetFile))
 
                   {
 
                       echo 'Move upload file and add propertyImgs<br>';
 
                       $this->property_model->addPropertyImgs($imgData);
 
                   }
 
                  }
 
              } else {
 
                  echo '$_FILES is empty';
 
              }
die();
 
            
and post the result

I removed everything my controller & added this code. But blank result, also changed the model to return last id
Reply

#24
Don't remove everything in your controller : it can't work...
your controller with change try and post the result):
PHP Code:
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');

/**
 * Class : Login (LoginController)
 * Login class to control to authenticate user credentials and starts user's session.
 * @author : Kishor Mali
 * @version : 1.1
 * @since : 15 November 2016
 */
class Home extends CI_Controller
{
 
   /**
     * This is default constructor of the class
     */
 
   public function __construct()
 
   {
 
     parent::__construct();
 
     $this->load->model('property_model');

 
    }

 
   /**
     * Index Page for this controller.
     */
 
   public function index()
 
   {
 
       $data = array('title'=> 'Vierra Property Broker''main_content'=>'home');
 
       $this->load->view('template'$data);

 
   }

 
   /**
     * Loaading the submit property form.
     */

 
   public function listProperty()

 
   {

 
     $data = array('title'=> 'Vierra Property Broker - Submit your Property''main_content'=>'submit_property');
 
     $this->load->view('template'$data);




 
   }



 
   function addProperty()
 
   {

 
       $this->load->library('form_validation');
 
          $this->form_validation->set_rules('prop_rooms','Rooms','trim|required|numeric');
 
          $this->form_validation->set_rules('prop_address','Address','trim|required|max_length[200]');
 
          $this->form_validation->set_rules('prop_owner_phone','Mobile Number','required|min_length[10]');
 
          $this->form_validation->set_rules('prop_owner_name','Owner Name','required|min_length[5]');
 
          $this->form_validation->set_rules('prop_owner_email','Owner Email','required|valid_email');

 
          if($this->form_validation->run())
 
          {
 
              $prop_title ucwords(strtolower($this->security->xss_clean($this->input->post('prop_title'))));
 
              $prop_status ucwords(strtolower($this->security->xss_clean($this->input->post('prop_status'))));
 
              $prop_type ucwords(strtolower($this->security->xss_clean($this->input->post('prop_type'))));
 
              $prop_price $this->security->xss_clean($this->input->post('prop_price'));
 
              $prop_sqft $this->security->xss_clean($this->input->post('prop_sqft'));
 
              $prop_rooms $this->security->xss_clean($this->input->post('prop_rooms'));
 
              $prop_address $this->security->xss_clean($this->input->post('prop_address'));
 
              $prop_owner_name $this->security->xss_clean($this->input->post('prop_owner_name'));
 
              $prop_owner_email $this->security->xss_clean($this->input->post('prop_owner_email'));
 
              $prop_owner_phone $this->security->xss_clean($this->input->post('prop_owner_phone'));
 
              $prop_detailed_info $this->security->xss_clean($this->input->post('prop_detailed_info'));
 
              $prop_current_status $this->security->xss_clean($this->input->post('prop_current_status'));
 
               $propertyInfo = array('title'=>$prop_title'status'=>$prop_status'type'=>$prop_type'price'=>$prop_price,
 
                                     'sqft'=>$prop_sqft'rooms'=>$prop_rooms'address'=>$prop_address'name'=>$prop_owner_name,
 
                                     'email'=>$prop_owner_email'phone'=>$prop_owner_phone'detailedInfo'=>$prop_detailed_info,
 
                                     'currentStatus'=>$prop_current_status);
 
              $result $this->property_model->addNewProperty($propertyInfo);
 
              if (!empty($_FILES)) {
 
                  $count_img count($_FILES['file']['name']);
 
                  foreach($_FILES['file']['tmp_name'] as $key => $value) {

 
                   $tempFile $_FILES['file']['tmp_name'][$key];
 
                   $fileName $_FILES['file']['name'][$key];
 
                   $targetPath 'property-images/';
 
                   $targetFile $targetPath $fileName ;

 
                   //$this->load->model('user_model');

 
                   $imgData = array('path'=>$targetFile,'propertyid'=>$result);

 
                   if(move_uploaded_file($tempFile$targetFile))
 
                   {
 
                       echo 'Move upload file and add propertyImgs<br>';
 
                       $this->property_model->addPropertyImgs($imgData);
 
                   }
 
                  }
 
              } else {
 
                  echo '$_FILES is empty';
 
              }
die();
 
            }
 
              if($result 0)
 
              {
 
                 //$propertyImgUpload = uploadImages($result);
 
                  $this->session->set_flashdata('success''Thank you for submiting your property with us!, Our team will contact you shortly');
 
              }
 
              else
 
              {
 
                  $this->session->set_flashdata('error''Submission of property failed, Contact wasim@vpd.ae');
 
              }
 
              if (!empty($_FILES)) {
 
                  $count_img count($_FILES['file']['name']);
 
                  foreach($_FILES['file']['tmp_name'] as $key => $value) {

 
                   $tempFile $_FILES['file']['tmp_name'][$key];
 
                   $fileName $_FILES['file']['name'][$key];
 
                   $targetPath 'property-images/';
 
                   $targetFile $targetPath $fileName ;

 
                   //$this->load->model('user_model');

 
                   $imgData = array('path'=>$targetFile,'propertyid'=>$result);

 
                   if(move_uploaded_file($tempFile$targetFile))
 
                   {
 
                       $this->property_model->addPropertyImgs($imgData);
 
                   }
 
                  }
 
              }
 
              redirect('/submit-property');
 
          }
 
        }


function 
check_captcha()
{


 
  if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])){
 
    $gCaptcha $_POST['g-recaptcha-response'];
 
   // Google reCAPTCHA API secret key
 
  $secretKey '6LekZagUAAAAALlguY5sjircXO6Adre6BDDHQWV_';

 
  // Verify the reCAPTCHA response
 
  $verifyResponse file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secretKey.'&response='.$gCaptcha);

 
  // Decode json data
 
  $responseData json_decode($verifyResponse);

 
  print_r($responseData);

}
else {
//$this->load->view('upload_index');

}

}


?>
Reply

#25
(06-12-2019, 04:16 AM)hc-innov Wrote: Don't remove everything in your controller : it can't work...
your controller with change try and post the result):
PHP Code:
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');

/**
 * Class : Login (LoginController)
 * Login class to control to authenticate user credentials and starts user's session.
 * @author : Kishor Mali
 * @version : 1.1
 * @since : 15 November 2016
 */
class Home extends CI_Controller
{
 
   /**
     * This is default constructor of the class
     */
 
   public function __construct()
 
   {
 
     parent::__construct();
 
     $this->load->model('property_model');

 
    }

 
   /**
     * Index Page for this controller.
     */
 
   public function index()
 
   {
 
       $data = array('title'=> 'Vierra Property Broker''main_content'=>'home');
 
       $this->load->view('template'$data);

 
   }

 
   /**
     * Loaading the submit property form.
     */

 
   public function listProperty()

 
   {

 
     $data = array('title'=> 'Vierra Property Broker - Submit your Property''main_content'=>'submit_property');
 
     $this->load->view('template'$data);




 
   }



 
   function addProperty()
 
   {

 
       $this->load->library('form_validation');
 
          $this->form_validation->set_rules('prop_rooms','Rooms','trim|required|numeric');
 
          $this->form_validation->set_rules('prop_address','Address','trim|required|max_length[200]');
 
          $this->form_validation->set_rules('prop_owner_phone','Mobile Number','required|min_length[10]');
 
          $this->form_validation->set_rules('prop_owner_name','Owner Name','required|min_length[5]');
 
          $this->form_validation->set_rules('prop_owner_email','Owner Email','required|valid_email');

 
          if($this->form_validation->run())
 
          {
 
              $prop_title ucwords(strtolower($this->security->xss_clean($this->input->post('prop_title'))));
 
              $prop_status ucwords(strtolower($this->security->xss_clean($this->input->post('prop_status'))));
 
              $prop_type ucwords(strtolower($this->security->xss_clean($this->input->post('prop_type'))));
 
              $prop_price $this->security->xss_clean($this->input->post('prop_price'));
 
              $prop_sqft $this->security->xss_clean($this->input->post('prop_sqft'));
 
              $prop_rooms $this->security->xss_clean($this->input->post('prop_rooms'));
 
              $prop_address $this->security->xss_clean($this->input->post('prop_address'));
 
              $prop_owner_name $this->security->xss_clean($this->input->post('prop_owner_name'));
 
              $prop_owner_email $this->security->xss_clean($this->input->post('prop_owner_email'));
 
              $prop_owner_phone $this->security->xss_clean($this->input->post('prop_owner_phone'));
 
              $prop_detailed_info $this->security->xss_clean($this->input->post('prop_detailed_info'));
 
              $prop_current_status $this->security->xss_clean($this->input->post('prop_current_status'));
 
               $propertyInfo = array('title'=>$prop_title'status'=>$prop_status'type'=>$prop_type'price'=>$prop_price,
 
                                     'sqft'=>$prop_sqft'rooms'=>$prop_rooms'address'=>$prop_address'name'=>$prop_owner_name,
 
                                     'email'=>$prop_owner_email'phone'=>$prop_owner_phone'detailedInfo'=>$prop_detailed_info,
 
                                     'currentStatus'=>$prop_current_status);
 
              $result $this->property_model->addNewProperty($propertyInfo);
 
              if (!empty($_FILES)) {
 
                  $count_img count($_FILES['file']['name']);
 
                  foreach($_FILES['file']['tmp_name'] as $key => $value) {

 
                   $tempFile $_FILES['file']['tmp_name'][$key];
 
                   $fileName $_FILES['file']['name'][$key];
 
                   $targetPath 'property-images/';
 
                   $targetFile $targetPath $fileName ;

 
                   //$this->load->model('user_model');

 
                   $imgData = array('path'=>$targetFile,'propertyid'=>$result);

 
                   if(move_uploaded_file($tempFile$targetFile))
 
                   {
 
                       echo 'Move upload file and add propertyImgs<br>';
 
                       $this->property_model->addPropertyImgs($imgData);
 
                   }
 
                  }
 
              } else {
 
                  echo '$_FILES is empty';
 
              }
die();
 
            }
 
              if($result 0)
 
              {
 
                 //$propertyImgUpload = uploadImages($result);
 
                  $this->session->set_flashdata('success''Thank you for submiting your property with us!, Our team will contact you shortly');
 
              }
 
              else
 
              {
 
                  $this->session->set_flashdata('error''Submission of property failed, Contact wasim@vpd.ae');
 
              }
 
              if (!empty($_FILES)) {
 
                  $count_img count($_FILES['file']['name']);
 
                  foreach($_FILES['file']['tmp_name'] as $key => $value) {

 
                   $tempFile $_FILES['file']['tmp_name'][$key];
 
                   $fileName $_FILES['file']['name'][$key];
 
                   $targetPath 'property-images/';
 
                   $targetFile $targetPath $fileName ;

 
                   //$this->load->model('user_model');

 
                   $imgData = array('path'=>$targetFile,'propertyid'=>$result);

 
                   if(move_uploaded_file($tempFile$targetFile))
 
                   {
 
                       $this->property_model->addPropertyImgs($imgData);
 
                   }
 
                  }
 
              }
 
              redirect('/submit-property');
 
          }
 
        }


function 
check_captcha()
{


 
  if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])){
 
    $gCaptcha $_POST['g-recaptcha-response'];
 
   // Google reCAPTCHA API secret key
 
  $secretKey '6LekZagUAAAAALlguY5sjircXO6Adre6BDDHQWV_';

 
  // Verify the reCAPTCHA response
 
  $verifyResponse file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secretKey.'&response='.$gCaptcha);

 
  // Decode json data
 
  $responseData json_decode($verifyResponse);

 
  print_r($responseData);

}
else {
//$this->load->view('upload_index');

}

}


?>

I'm getting $_FILES is empty

I use dropzone js to post the image files to here.
Reply

#26
addProperty.js (JS File )

Code:
/**
* File : addUser.js
*
* This file contain the validation of add user form
*
* Using validation plugin : jquery.validate.js
*
* @author Sarath Chandran
*/

 $(document).ready(function(){

   $("#error_msg").hide();


     var addPropertyForm = $("#property-form");

     var validator = addPropertyForm.validate({

        rules:{
            //prop_title :{ required : true },
            //prop_status : { required : true, selected : true },
            //prop_type : {required : true, selected: true },
     prop_rooms : {required : true, selected: true },
     prop_address :{ required : true },
     prop_owner_name :{ required : true },
     //prop_detailed_info :{ required : true },
     prop_owner_email :{ required : true, email : true },
     prop_owner_phone :{ required : true, digits : true },
            //prop_price : { required : true, digits : true },
     //prop_sqft : { required : true, digits : true }


        },
        messages:{
            //prop_title :{ required : "Please enter title of villa" },
            //prop_status : { required : "Please select status", selected : "Please select atlease one option" },
     //prop_type : { required : "Please select type of villa", selected : "Please select atlease one option" },
     prop_rooms : { required : "Please select bed rooms", selected : "Please select atlease one option" },
            prop_address : { required : "Please enter address of villa"},
     prop_owner_name : { required : "Please enter name of owner"},
     prop_owner_email : { required : "Please enter email of owner", email : "Please enter valid email"},
     prop_owner_phone : { required : "Please enter phone of owner", digits : "Please enter valid phone no"},
     //prop_price : { required : "Please enter price of villa", digits : "Please enter price in digits"},
     //prop_detailed_info : { required : "Please enter detailed information"},
     //prop_sqft : { required : "Please enter size of villa", digits : "Please enter size in Sqft"}

        },



})



Dropzone.autoDiscover = false;

   $("div#myDropzone").dropzone({

       url: 'list-property',
       addRemoveLinks: true,
       paramName: "file",
       maxFiles:11,
       autoProcessQueue: false,
       uploadMultiple: true,
       acceptedFiles: "image/*",
       maxFilesize: 1,
       parallelUploads: 10,

       init: function () {

           var myDropzone = this;

           document.getElementById("submit-all").addEventListener("click", function(e) {
                       // Make sure that the form isn't actually being sent.
                       e.preventDefault();



             $(window).scrollTop(0);

             //e.preventDefault();

             if ( $("#property-form").valid() ) {
               myDropzone.processQueue();

             }

             });





           this.on("complete", function (file) {
             if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {

                 //alert("Completed Upload");
                 $("#property-form").submit();
           }

         });






 }



});





});
Reply

#27
It's a good news. You have a problem with dropzone not your php code.
Post your javascript code that uses dropzone and your form
Reply

#28
HTML Form

PHP Code:
<div class="content-area-7 submit-property">
 
   <div class="container">
 
       <div class="row">
 
           <div class="col-md-12">

 
         <!--      <div id="error_message" class="notification-box"></div> -->





 
           </div>

 
           <?php
                $this
->load->helper('form');






 
               $error $this->session->flashdata('error');
 
               if($error)
 
               {
 
                 echo '<div class="notification-box">'.$error.'</div>';

 
               }

 
               $success $this->session->flashdata('success');
 
               if($success)
 
               {
 
                 echo '<div class="notification-box">'.$success.'</div>';

 
               }

 
               ?>

                <div id="error_msg" class="alert alert-danger wow fadeInRight delay-01s" role="alert" style="visibility: visible; animation-name: fadeInRight;">
                  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
                  <strong>Oops!</strong>, Please fix the following errors and submit again
                </div>

            <div class="col-md-12">
                <div class="submit-address">


                    <form name = "property-form" action="<?php echo base_url() ?>list-property" method="post" id="property-form">
                        <div class="main-title-2">
                            <h1><span>Tell Me</span> Something About Your Property</h1>
                        </div>
                        <div class="search-contents-sidebar mb-30">
                            <div class="form-group">
                                <label>Property Title</label>

                                <input class="input-text" name="prop_title" id="prop_title" placeholder="Property Title">
                                <?php echo form_error('prop_title'); ?>
                            </div>

                            <div class="row">
                                <div class="col-md-6 col-sm-6">
                                    <div class="form-group">
                                        <label>Status</label>
                                        <select class="form-control required" id="prop_status" name="prop_status">
                                          <option value="">Select</option>
                                            <option value="Sale">For Sale</option>
                                            <option value="Rent">For Rent</option>
                                        </select>

                                    </div>

                                </div>
                                <div class="col-md-6 col-sm-6">
                                    <div class="form-group">
                                        <label>Type</label>
                                        <select class="form-control required" id="prop_type" name="prop_type">
                                          <option value="">Select</option>
                                            <option value="Modern">Modern</option>
                                            <option value="Traditional">Traditional</option>
                                            <option value="Arabic">Arabic</option>

                                        </select>


                                    </div>

                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-3 col-sm-6">
                                    <div class="form-group">
                                        <label>Price (Dirham)</label>
                                        <input class="input-text" name="prop_price" id="prop_price" placeholder="AED">
                                        <?php echo form_error('prop_price'); ?>

                                    </div>
                                </div>
                                <div class="col-md-3 col-sm-6">
                                    <div class="form-group">
                                        <label>Sqft</label>
                                        <input class="input-text" name="prop_sqft" id="prop_sqft" placeholder="SqFt">
                                        <?php echo form_error('prop_sqft'); ?>


                                    </div>
                                </div>
                                <div class="col-md-3 col-sm-6">
                                    <div class="form-group">
                                        <label>Bed Rooms</label>
                                        <select class="form-control required" name="prop_rooms" id="prop_rooms">
                                            <option value="">Select</option>
                                            <option value="3">3</option>
                                            <option value="4">4</option>
                                            <option value="5">5</option>

                                        </select>


                                    </div>
                                </div>
                                <!-- <div class="col-md-3 col-sm-6">
                                    <div class="form-group">
                                        <label>Bathroom</label>
                                        <select class="selectpicker search-fields" name="1">
                                            <option>1</option>
                                            <option>2</option>
                                            <option>3</option>
                                            <option>4</option>
                                            <option>5</option>
                                            <option>6</option>
                                        </select>
                                    </div>
                                </div> -->
                            </div>
                        </div>


                        <div class="main-title-2">
                            <h1><span>Location</span></h1>
                        </div>
                        <div class="row mb-30 ">
                            <div class="col-md-6 col-sm-6">
                                <div class="form-group">
                                    <label>Address</label>
                                    <input class="input-text" id="prop_address" name="prop_address"  placeholder="Address">
                                </div>
                                <?php echo form_error('prop_address'); ?>


                            </div>



                        </div>
                        <div class="main-title-2">
                            <h1><span>Contact</span> Details</h1>
                        </div>
                        <div class="row">
                            <div class="col-md-4 col-sm-4">
                                <div class="form-group">
                                    <label>Name</label>
                                    <input class="input-text" name="prop_owner_name" id="prop_owner_name" placeholder="Name">
                                    <?php echo form_error('prop_owner_name'); ?>

                                </div>
                            </div>
                            <div class="col-md-4 col-sm-4">
                                <div class="form-group">
                                    <label>Email</label>
                                    <input class="input-text" name="prop_owner_email" id="prop_owner_email" placeholder="Email">
                                    <?php echo form_error('prop_owner_email'); ?>

                                </div>
                            </div>

                            <div class="col-md-4 col-sm-4">
                                <div class="form-group">
                                    <label>Contact No</label>
                                    <input class="input-text" name="prop_owner_phone" id="prop_owner_phone" placeholder="Phone">
                                    <?php echo form_error('prop_owner_phone'); ?>

                                </div>
                            </div>



                            </div>


                        <div class="main-title-2">
                        <h1><span>Upload</span> Photos Of Villa </h1>
                        </div>

                        <div id="myDropzone" class="dropzone dropzone-design mb-10">
                          <div class="dz-default dz-message" data=""><span>Drop files here to upload</span></div>
                                                </div>

                        <div class="main-title-2">
                            <h1><span>Detailed</span> Information</h1>
                        </div>



                        <div class="row mb-30">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <textarea class="input-text" id="prop_detailed_info" name="prop_detailed_info" placeholder="Detailed Information"></textarea>
                                </div>
                                <?php echo form_error('prop_detailed_info'); ?>
                            </div>
                        </div>




                          </div>



                            <div class="col-md-12">
                              <input type="submit" class="btn button-sm button-theme" value="Submit" />

                            </div>
                            <script src="<?php echo base_url('assets/frontend/js/addProperty.js'); ?>"></script>

                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div> 
Reply

#29
@hc-innov

Buddy, You there ?

I think so the problem with dropzone. Because dropzone also posting the image values to the controller. How we can fix the issue ?
Reply

#30
remove the die() in your controller and the redirect function.
your javascript code with change
Open your console in your browser
DON'T FORGET to add the class dropzone to your form and remove the class dropzone to your div

Code:
Dropzone.options.propertyForm({
      addRemoveLinks: true,
      paramName: "file",
      maxFiles:11,
      autoProcessQueue: false,
      uploadMultiple: true,
      acceptedFiles: "image/*",
      maxFilesize: 1,
      parallelUploads: 10,

      init: function () {
          var myDropzone = this;
          document.getElementById("submit-all").addEventListener("click", function(e) {
            e.preventDefault();
            e.stopPropagation();
            $(window).scrollTop(0);

            if ( $("#property-form").valid() ) {
              myDropzone.processQueue();

            }

            });
                  // Listen to the sendingmultiple event. In this case, it's the sendingmultiple event instead
           // of the sending event because uploadMultiple is set to true.
           this.on("sendingmultiple", function() {
             console.log('send event');
           });
           this.on("successmultiple", function(files, response) {
             console.log(response);
           });
           this.on("errormultiple", function(files, response) {
             console.log('error');
           });

       }  
   });
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.