Multiple Image Upload and Resize Image In CodeIgniter

Multiple Image Upload and Resize Image In CodeIgniter First you must load “image_lib” library of CI. This is a controller in CI public function imageUpload()     {         $data = array();         if ($this->input->post(‘submit’))         {             if ($_FILES[“sc_name”][“name”])             {                 $path = ‘./upload_image’;                 if (!is_dir($path))                …

Read More

CodeIgniter – File upload required validation

CodeIgniter – File upload required validation Que: <?php echo form_open_multipart(‘add’); ?> <fieldset>     <input type=”text” name=”name” /><br>     <input type=”text” name=”code” /><br>     <input type=”file” name=”userfile” /><br><br>     <input type=”submit”value=”Add” /> </fieldset> <?php echo form_close(); ?> Ans: I found a solution that works exactly how I want. I changed $this->form_validation->set_rules(‘name’, ‘Name’, ‘trim|required’); $this->form_validation->set_rules(‘code’, ‘Code’, ‘trim|required’); $this->form_validation->set_rules(‘userfile’, ‘Document’, ‘required’); To $this->form_validation->set_rules(‘name’, ‘Name’, ‘trim|required’); $this->form_validation->set_rules(‘code’, ‘Code’, ‘trim|required’); if (empty($_FILES[‘userfile’][‘name’])) {     $this->form_validation->set_rules(‘userfile’, ‘Document’, ‘required’); }

Read More