Viewing 2 reply threads
  • Author
    Posts
    • #3028
      dawood
      Member

      Hey Folks, sorry for repeating this post but am still confused about how the image upload field works:

      I am doing this tutorial: https://piklist.com/user-guide/tutorials/displaying-images-upload-field/

      After creating this for a custom post type:

      // Upload Image / File
        piklist('field', array(
        'type' => 'file'
        ,'field' => 'my_image'
        ,'label' => 'Upload image'
      ));
      

      I then follwed by doing this

      $image_ids = get_post_meta($post_id, 'my_image');
      

      but now I am trying to call:

       print_r($image_ids);
      

      and no array gets output.

      what am I doing wrong? How do I get the images uploaded in the custom postype?

    • #3031
      dawood
      Member

      $image_ids = get_post_meta(get_the_ID(), ‘my_image’);
      print_r($image_ids);
      works

      and this works too

      $image_ids = get_post_meta($post-> ID, ‘my_image’);
      print_r($image_ids);

      how come what’s in the tutorial doesn’t?

    • #3037
      Steve
      Keymaster

      @dawood– Don’t be confused. We updated the tutorial to $post->ID. As long as you can get the post ID, you’re find.

Viewing 2 reply threads
  • The topic ‘Still Confused about File / Image Upload’ is closed to new replies.