Mysql
 sql >> Teknologi Basis Data >  >> RDS >> Mysql

File Gambar CodeIgniter tidak dapat diunggah

jika menyimpan data tanpa gambar maka

public function create() {
    //check if user is logged in
    if (!$this->session->userdata('logged_in')) {
      redirect('users/login');
    }

    $this->form_validation->set_rules('mjestoPolaska', 'Mjesto Polaska', 'required');
    $this->form_validation->set_rules('mjestoOdredista', 'Mjesto Odredista', 'required');
    $this->form_validation->set_rules('datumPolaska', 'Datum Polaska', 'required');
    $this->form_validation->set_rules('datumPovratka', 'Datum Povratka', 'required');
    $this->form_validation->set_rules('cijena', 'Cijena', 'required');
    $this->form_validation->set_rules('brojMjesta', 'Broj mjesta', 'required');
    $this->form_validation->set_rules('opis', 'Opis', 'required');


    $data['title'] = 'Create Posts';
    $data['categories'] = $this->Posts_model->get_categories();

    if ($this->form_validation->run() === FALSE) {

      $this->session->set_flashdata("error", validation_errors());
      $this->load->view('templates/header');
      $this->load->view('posts/create', $data);
      $this->load->view('templates/footer');
    } else {
      $post_image='';
      if (!empty($_FILES['userfile']['name'])) {
        $path = 'assets/images/posts/';
        $post_image = $this->ImageUpload($path, 'userfile', '');
        if (!is_array($post_image)) {

          $this->session->set_flashdata('error', $post_image);
          redirect(site_url() . 'posts/create');
        }
        $post_image = $post_image['file_name'];
      }


      $this->Posts_model->create_post($post_image);
      $this->session->set_flashdata('post_creted', 'You post has been created');
      redirect('posts');
    }
  }


  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Memilih catatan antara dua tanggal

  2. JDBC di Skrip Google Apps. Pengecualian:Pernyataan dibatalkan karena batas waktu atau permintaan klien

  3. Kegagalan instalasi MySql 8.0.15 Template Server Tidak Valid

  4. Bagaimana saya bisa mendapatkan daftar akun pengguna menggunakan baris perintah di MySQL?

  5. Simpan gambar yang dikodekan base64 ke database sisi server sebagai BLOB