Return to Snippet

Revision: 20830
at November 26, 2009 08:49 by ksantoshp


Updated Code
if($_FILES['logo']['name']!='') {                       
                        $img = explode('.', $_FILES['logo']['name']);
                        $img_path = $img_dir.'/logo'.$img[1];
                        $extension = strtolower($img[1]);
                        if(in_array($extension , array('jpg','jpeg', 'gif', 'png', 'bmp'))){
                                move_uploaded_file($_FILES['logo']['tmp_name'], $img_path);
                                update_site_option('rt_blog_thumb', $blog_thumb);
                        }
                        else echo 'Invalid file';
                }

Revision: 20829
at November 26, 2009 08:45 by ksantoshp


Updated Code
if(!empty($_FILES)){
                        $img = explode('.', $_FILES['thumb_img']['name']);
                        $img_path = $img_dir .$img[0].time().'.'.$img[1];
                        $img_thumb = $img_dir .$img[0].time().'_thumb.'.$img[1];
                        $extension = strtolower($img[1]);
                        if(in_array($extension , array('jpg','jpeg', 'gif', 'png', 'bmp'))){

                                move_uploaded_file($_FILES['thumb_img']['tmp_name'], $img_path);
                                $blog_thumb = get_site_option('rt_blog_thumb');
                                $blog_thumb[$blog_id] = basename($img_thumb);
                                update_site_option('rt_blog_thumb', $blog_thumb);
                        }
                        else echo 'Invalid file';
                }

Revision: 20828
at November 26, 2009 08:25 by ksantoshp


Initial Code
if($_POST) {
        //print_r($_POST);
                $rt_hd_panel_options = $_POST;
                $rt_hd_panel_options['google_analytics'] = stripslashes($_POST['google_analytics']);
                update_option('rt_hd_panel_options', $rt_hd_panel_options);

                if($_FILES['logo']['name']!='') {
                        echo '<pre>';
                        print_r($_FILES);
                        echo '</pre>';
                }
        }

Initial URL

                                

Initial Description

                                

Initial Title
Image Validation

Initial Tags
image, validation

Initial Language
PHP