I am not sure what I am doing wrong. The form is set up with an upload field that sends data to a custom field in a custom post type. All of the other fields in the form are working great and the post is publishing as expected. The file that gets uploaded gets loaded into the media library and shows as being attached to the post.
When I go to edit that post that I am pouring the data into, it only shows a number (in this case 32). It does not show the URL of the file, which is what I was expecting.
Am I doing something wrong or should I be going about the this differently?
Attached a screenshot of the fields settings.





August 20, 2011 at 9:55 pm
btw the number changes with each submission.
August 21, 2011 at 8:27 am
I'm taking huge stab at this but I'm guessing that if these files are appearing in your Media Library after submission that the number you're seeing is the "post_id" associated with that file upload.
If that is the case, then the URL is located in the "wp_postmeta" table and the "32" is probably the "post_id". If you query that table with that post_id, you should get a return for the "meta_key" field with a value of "_wp_attached_file" and the "meta_value" field would contain the URL of the file.
Again, huge stab and that's if Formidable is putting the file in the Media Library. If you have access to your MySQL db, then you can probably find exactly what you're looking for in the "wp_postmeta" or the "wp_frm_item_metas" table.
August 22, 2011 at 9:08 am
netsendus is right. In order for more flexibility, the media ID is saved rather than a specific URL. This can be added to your theme in a couple of different ways. The easiest way would be to use a theme that supports the post thumbnail feature. There are instructions for setting a field to the post thumbnail at the bottom of this page:
http://formidablepro.com/knowledgebase/create-a-post-form-and-display-the-results/
The other option is to edit your theme a little. Something like this will display the image on the page:
global $post;
$media_id = get_post_meta($post->ID, 'custom_field_name_here', true);
echo wp_get_attachment_image($media_id);
http://codex.wordpress.org/Function_Reference/wp_get_attachment_image
August 22, 2011 at 3:29 pm
Ok, I have been working on this for a bit today and was not getting any results so turning back to you. I would like to stick with the 2nd option. Can you tell me exactly where and how to put this code? Before or in the loop? Am I using it to call the data or just to set it up for the data? Thank you for your help!
August 23, 2011 at 9:14 am
This code will go exactly where you want the image to show, so in the loop. The above code is pasted below with additional comments.
global $post; //get the current post
$media_id = get_post_meta($post->ID, 'custom_field_name_here', true); //get the value from the custom field for the current post. Replace 'custom_field_name_here' with the name of your custom field
echo wp_get_attachment_image($media_id); //get and display the image from the image ID
By the way, is this for the single post page? If so, please take a look at this video:
http://formidablepro.com/knowledgebase/create-a-post-form-and-display-the-results/
August 27, 2011 at 7:04 pm
Ok so still not working. Very frustrating I know but once I figure out how this is done will be used for so many things.
Thanks for the support. Has been great thus far!
Attachment:
August 29, 2011 at 9:13 am
This code returns <img src="image.gif" />
<?php global $post;
$media_id = get_post_meta($post->ID, '_ct_text_4e42019c85f95', true); echo
wp_get_attachment_image($media_id); ?>
This means it will not work the way you are using it. Instead, change wp_get_attachment_image to wp_get_attachment_url.
Topic closed.