title: Adding programatically more downloadable files for products in WooCommerce
body: <p>I am trying to uploaded one more downloadable files in woocommerce product. I have already one downloadable file in my product and want to add one more. </p>
  
  <p>For this I am using following code:</p>
  
  <pre><code>if($_FILES){
  $attachment_id = media_handle_upload( 'abe_update_epub', $post_id );
      if ( is_wp_error( $attachment_id ) ) {
          $errors = $attachment_id-&gt;get_error_messages();
          foreach( $errors as $error ){
              echo $error;
          }
      echo 'There was an error uploading the image';
      } else {
      // to get exiting file/Old file
      $abe_file = get_post_meta($abe_post_id, '_downloadable_files', true);
          foreach($abe_file as $abe){
              $name = $abe['name'];
              $url = $abe['file'];
          }
      // This is my new file which i want to upload also
          $file_name = 'Epub Files';
          $file_url1 = wp_get_attachment_url($attachment_id);
          $files[md5( $file_url )] = array(
              'name' =&gt; $file_name,
              'file' =&gt; $file_url
          );
          update_post_meta( $post_id, '_downloadable_files', $files );
          echo 'The image was uploaded successfully!';
      }
  }
  </code></pre>
  
  <p>This function upload files in a correct way, <strong>But it replace the old file by the new one.</strong></p>
  
  <p>How I can solve this issue? <br>
  What am I doing wrong in this script?</p>
  
  <p>Thanks</p>