Title: Get Upload fields (Custom fields)
Last modified: April 3, 2018

---

# Get Upload fields (Custom fields)

 *  Resolved [Inao](https://wordpress.org/support/users/inao/)
 * (@inao)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/get-upload-fields-custom-fields/)
 * Thanks for your support. I have created a repeater upload field, I use with PDF
   files. but I can’t get back them. I only get back a number, but I did not figure
   out how to use it to retrieve the specific attachment.
 * As documentation suggested i used:
 * <?php foreach( get_cfc_meta(‘adjuntos’) as $key => $value ){
    ?> “/><?php } ?
   >
 * I know it is wrong.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Georgian Cocora](https://wordpress.org/support/users/raster02/)
 * (@raster02)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/get-upload-fields-custom-fields/#post-10153055)
 * Hello [@inao](https://wordpress.org/support/users/inao/),
 * The number that you get is an attachment ID that points to the file. To get the
   URL, you need to use the [wp_get_attachment_url()](https://codex.wordpress.org/Function_Reference/wp_get_attachment_url)
   function over that number.
 * Let me know if this worked !
 * Regards.
 *  Thread Starter [Inao](https://wordpress.org/support/users/inao/)
 * (@inao)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/get-upload-fields-custom-fields/#post-10159462)
 * I’m so sorry my php knowledge is poor. I tried the following but it did not work.
 * <?php foreach(get_cfc_meta(‘adjuntos’) as $key => $value ){
    ?><?php wp_get_attachment_url(
   the_cfc_field(‘adjuntos’, ‘attached’)) ?><?php } ?>
 * Thanks!
 *  Plugin Author [Georgian Cocora](https://wordpress.org/support/users/raster02/)
 * (@raster02)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/get-upload-fields-custom-fields/#post-10169742)
 * Hello [@inao](https://wordpress.org/support/users/inao/),
 * Put an `echo` before wp_get_attachment_url and it should display the URL of the
   file.
 * ex.
 *     ```
       <?php foreach(get_cfc_meta(‘adjuntos’) as $key => $value ){
       ?><?php echo wp_get_attachment_url(the_cfc_field(‘adjuntos’, ‘attached’)) ?><?php
       }
       ?>
       ```
   
 * Regards.
 *  Thread Starter [Inao](https://wordpress.org/support/users/inao/)
 * (@inao)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/get-upload-fields-custom-fields/#post-10180191)
 * I’m sorry it is only retrieving me the number :(.
    here the complete peace of
   code:
 *  `<?php
    $args = array( ‘post_type’ => ‘correspondencia’, ‘meta_key’ => ‘codigo’,‘
   meta_value’ => $resulthwe_meta[0]->meta_value, ‘order’ => ‘ASC’ ); $custom_query
   = new WP_Query( $args);
 * if ( $custom_query->have_posts() ) : while ( $custom_query->have_posts() ) : 
   $custom_query->the_post();
 * ?>
 *  <?php $i = 0;?>
    <?php if($i == 0){ echo “<div>”; }?> <div class=”fullrowdiv”
   > <div class=”rc_excol”><?php the_cfc_field(‘cartas’, ‘fecha’); ?></div> <?php
   $i++;?> <div class=”rc_excol2″><a href=”<?php the_cfc_field(‘cartas’, ‘archivo’);?
   >” target=”_blank”><?php the_title(); ?></a></div> <?php $i++;?> <div class=”
   rc_excol3″><?php the_cfc_field(‘cartas’, ‘remitente’); ?></div> <?php $i++;?>
   <div class=”rc_excol4″><?php foreach(get_cfc_meta(‘adjuntos’) as $key => $value){?
   ><?php echo wp_get_attachment_url(the_cfc_field(‘adjuntos’, ‘attached’)); ?><?
   php } ?> </div> </div> <?php $i++;?> <?php if($i == 4){ echo “</div>”; $i=0;}?
   > <?php endwhile; ?> <?php if($i < 4) echo ‘</div>’; ?> <?php endif; wp_reset_query();?
   >
 * </div>`
 * This is an example page: [http://forecos.cl/plataforma-servidumbre-de-conservacion-reserva-costera-valdiviana/show-all-project/formulario-de-antecedentes/historial-de-solicitudes/?entry=329](http://forecos.cl/plataforma-servidumbre-de-conservacion-reserva-costera-valdiviana/show-all-project/formulario-de-antecedentes/historial-de-solicitudes/?entry=329)
 *  Plugin Author [Georgian Cocora](https://wordpress.org/support/users/raster02/)
 * (@raster02)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/get-upload-fields-custom-fields/#post-10185889)
 * Hello [@inao](https://wordpress.org/support/users/inao/),
 * You figured this out ? I’m seeing that only the first post doesn’t have the correct
   link, maybe the attachment ID for it is wrong ?
 * If you need more help with this, please [open a ticket on our website](https://www.cozmoslabs.com/support/open-ticket/).
 * Regards.
 *  Thread Starter [Inao](https://wordpress.org/support/users/inao/)
 * (@inao)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/get-upload-fields-custom-fields/#post-10188264)
 * Thanks Georgian, not yet, Ok I will follow in your website!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Get Upload fields (Custom fields)’ is closed to new replies.

 * ![](https://ps.w.org/wck-custom-fields-and-custom-post-types-creator/assets/icon-
   256x256.png?rev=2257602)
 * [Custom Post Types and Custom Fields creator - WCK](https://wordpress.org/plugins/wck-custom-fields-and-custom-post-types-creator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wck-custom-fields-and-custom-post-types-creator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wck-custom-fields-and-custom-post-types-creator/)
 * [Active Topics](https://wordpress.org/support/plugin/wck-custom-fields-and-custom-post-types-creator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wck-custom-fields-and-custom-post-types-creator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wck-custom-fields-and-custom-post-types-creator/reviews/)

## Tags

 * [custom_fields](https://wordpress.org/support/topic-tag/custom_fields/)

 * 6 replies
 * 2 participants
 * Last reply from: [Inao](https://wordpress.org/support/users/inao/)
 * Last activity: [8 years, 1 month ago](https://wordpress.org/support/topic/get-upload-fields-custom-fields/#post-10188264)
 * Status: resolved