jeudi 1 septembre 2016

Uploading multiples Images on checked checkbox option

I have a problem in uploading multiple images for checked checkbox you can check the below image

enter image description here

My requirement is that when i checked color option their image should be uploaded & image will be multiple like Red can have 2 images & Pink can have 5 images and save same in MYSQL DB.

I have written below code for this

 if(isset($_REQUEST['colorId'])){
    $counter = count($_REQUEST['colorId']); 
   for($i=0;$i<=$counter;$i++){
        echo $_REQUEST['colorId'][$i];
        foreach($_FILES['colorFile']['name'] as $key => $value ){
                $file_size =$_FILES['colorFile']['size'];
                $file_tmp =$_FILES['colorFile']['tmp_name'];
                $file_type=$_FILES['colorFile']['type'];    
                if($_FILES['colorFile']['name']!=''){
                       // INSERT QUERY
                        $desired_dir=$folder.$_FILES['colorFile'] 
                       ['name'];                                     
                     move_uploaded_file($file_tmp,$desired_dir);
                            }
                        }

                        }               
                    }

Can anyone help me.. for this?? Data inserting not happening properly




Aucun commentaire:

Enregistrer un commentaire