Error submitting a form with upload pic option. PHP Codeigniter

تعرفه تبلیغات در سایت
عنوان عکس
عنوان عکس
عنوان عکس
عنوان عکس
عنوان عکس


یافته ها در جستجو

    امکانات وب

    آرشیو مطالب

    برچسب ها

    I've been trying to upload a pic to a folder and store its path in the database, my code seems to work correctly, but no it's not, After i click submit button, it goes to a blank page. Using Inspect element, Network option in my browser, when seeing the parameters sent I see correct input from the text fields but for the image, Content-Disposition: form-data; name="myimage"; filename="IMG_8971.JPG" Content-Type: image/jpeg Plus some other weirly looking characters and symbols like :



    private function setup_upload_option()
        $config = array();
        $config['upload_path'] = 'blog/uploads/';
        $config['encrypt_name']= TRUE;
        return $config;
    public function post_new_blog()
        $this->form_validation->set_rules('title', 'Title of the Blog', 'trim|required');
        $this->form_validation->set_rules('desc', 'Content of the Blog', 'trim|required');
        $this->form_validation->set_rules('tags', 'Tags fo the blog', 'trim|required');
        if($this->form_validation->run()==FALSE) {
            $this->session->set_flashdata('fail', validation_errors());
            $this->load->view('blogsection/addblog', array('logged_in' => $this->logged_in));
        else {
            $files = $_FILES;
            $count = count($_FILES['myimage']['name']);
            for($i=0; $i<$count ;$i++)
                $_FILES['myimage']['name'] = $files['myimage']['name'][$i];
                $_FILES['myimage']['type'] = $files['myimage']['type'][$i];
                $_FILES['myimage']['size'] = $files['myimage']['size'][$i];
                $_FILES['myimage']['tmp_name'] = $files['myimage']['tmp_name'][$i];
                    $data = $this->upload->data();
                    $config1['image_library'] = 'gd2';
                    $config1['source_image']  = $data['full_path'];
                    $config1['new_image']     = 'blog/uploads/thumbs/';
                    $config1['create_thumb']  = false;
                    $config1['height']        = 200;
                    $config['width']          = 200;
                    $this->load->library('image_lib', $config1);
                    $mydata = $this->session->all_userdata();
                    $dataarray = array(
                        'blog_title' => $this->input->post('title', true),
                        'blog_content' => $this->input->post('desc', true),
                        'blog_tags' => $this->input->post('tags', true),
                        'blog_image_name' => $data['orig_name'],
                        'blog_image' => $data['full_path'],
                        'date_posted' => date(" jS of F Y "),
                        'posted_by' => $mydata['username']
                    $this->load->view('blogsection/addblog', array('logged_in' => $this->logged_in, 'success' => 'Blog was posted successfully',$dataarray));


    public function save_new_posts($dataarray)
        $this->db->insert('blogs', $dataarray);
            return true;
    نویسنده : استخدام کار بازدید : 80 تاريخ : چهارشنبه 3 خرداد 1396 ساعت: 2:34
    برچسب‌ها :
    اخبار و رسانه هاهنر و ادبیاترایانه و اینترنتعلم و فن آوریتجارت و اقتصاداندیشه و مذهبفوتو بلاگوبلاگ و وبلاگ نویسیفرهنگ و تاریخجامعه و سیاستورزشسرگرمی و طنزشخصیخانواده و زندگیسفر و توریسمفارسی زبان در دیگر کشورهاads-123