file upload field on checkout page woocommerce

I want to add a file upload field on checkout page in woocommerce.I have added it but when I click on “Place order” button and try to check post values,$_FILES array is empty while other fields on the same page ,same form are coming with respective values.I am using response using print_r().This issue also had been asked in below thread and explained well.I have exactly same problem as in this thread.

How to upload a image in woocommerce checkout page and link it to the order

Read More

Any help highly appreciated.

Related posts

Leave a Reply

2 comments

  1. //This code paste on funtion.php  
    //For upload image
    
    add_filter( 'woocommerce_shipping_fields', 
    'woo_filter_upload_shipping'        );
    
    function woo_filter_upload_shipping( $address_fields ) { 
    //  $address_fields['file_upload']['required'] = true;
    
    $address_fields['file_upload'] = array(
    //'label'     => __('Upload your ID', 'woocommerce'),
    'required'  => false,
    'class'     => array('form-row-wide'),
    'clear'     => true
    );
    
     return $address_fields;
     }
    
     //Using this function to show Upload field on your checkout page.
    
     function add_file_field(){
    
     $uploadFile   = "";
     $uploadFile   .='<div id="upload_CNIC_image">';
     $uploadFile .='<input id="file_upload" name="file_upload"
     type="file"    multiple="true">';
     $uploadFile .='<span id="">';
     $uploadFile .='</span>';
     $uploadFile .='</div>';
     echo $uploadFile;
     }
     add_action('woocommerce_after_order_notes','add_file_field');