title: file upload to a folder in wordpress
body: <p>I have use the below written code for move the file to a folder named "training".</p>
  
  <pre><code>  &lt;td&gt;
     &lt;input type="file" name="training_image" accept="image/*" id="traing-image"value="&lt;?php echo esc_attr( get_the_author_meta( 'training_image', $user-&gt;ID ) ); ?&gt;" class="regular-text" /&gt;
    &lt;/td&gt;
  </code></pre>
  
  <p>To save the image i wrote this</p>
  
  <pre><code>$training_path = time().'_'.$_FILES['training_image']['name'];
  $tmp_file_name = $_FILES['training_image']['tmp_name'];
  $upload_dir = wp_upload_dir();
  if($training_path){
         move_uploaded_file($tmp_file_name,$upload_dir['baseurl'].'/training/'.$training_path);
  }
  update_user_meta( $user_id, 'training-image', $training_path );
  </code></pre>
  
  <p>But i could not get any result. Did i do any mistake. please help me.</p>
  
  <p>This is my entire code</p>
  
  <pre><code>function training_user_profile_fields( $user ) { ?&gt;
  &lt;h3&gt;&lt;?php// _e("Extra profile information", "blank"); ?&gt;&lt;/h3&gt;
  
  &lt;table class="form-table"&gt;
    &lt;tr&gt;
      &lt;th&gt;&lt;label for="traing-image"&gt;&lt;?php _e("Upload Your Training Certificate:"); ?&gt;&lt;/label&gt;&lt;/th&gt;
        &lt;td&gt;
         &lt;input type="file" name="training_image" id="traing-image"value="&lt;?php echo esc_attr( get_the_author_meta( 'training_image', $user-&gt;ID ) ); ?&gt;" class="regular-text" /&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  &lt;?php }
  
  add_action( 'personal_options_update', 'save_extra_user_profile_fields' );
  add_action( 'edit_user_profile_update', 'save_extra_user_profile_fields' );
  
  function save_extra_user_profile_fields( $user_id ) {
  
  if ( !current_user_can( 'edit_user', $user_id ) ) { return false; }
  $training_path = time().'_'.$_FILES['training_image']['name'];
  $tmp_file_name = $_FILES['training_image']['tmp_name'];
  echo "filename".$_FILES['training_image']['tmp_name']; exit;
  $upload_dir = wp_upload_dir();
  if($training_path){
         move_uploaded_file($tmp_file_name,$upload_dir['baseurl'].'/training/'.$training_path);
  }
  update_user_meta( $user_id, 'training-image', $training_path );
  }
  </code></pre>