Title: how to upload image in post form?
Last modified: April 21, 2024

---

# how to upload image in post form?

 *  Resolved [hugofant](https://wordpress.org/support/users/hugofant/)
 * (@hugofant)
 * [2 years ago](https://wordpress.org/support/topic/how-to-upload-image-in-post-form/)
 * Hi,
   i’m doing my first steps with forminator (free) and the idea was to create
   a form for frontend posting.Everything looked good but when creating a post, 
   the editor doesn’t offer image upload/integration.as the standard “post data”
   field offer only the “featured image” (don’t want to use that), i added an additional
   field to the form (file upload). It is shown in the form, i can select a picture,
   but after submission, its gone – not existing in media library, not shown in 
   post.then i realized that i can link an the “upload field” to “custom field” 
   in the “Post Data” field….same behavior.The files seem to be uploaded to the 
   forminator folder correctly, but they are not show in the library and also not
   in the post.Am i doing something wrong, or is there something special to consider?
   Is it possible to change the editor – to one whichs offers upload, and ideally
   with sizing option and showing it with in the text?
    -  This topic was modified 2 years ago by [hugofant](https://wordpress.org/support/users/hugofant/).
    -  This topic was modified 2 years ago by [hugofant](https://wordpress.org/support/users/hugofant/).
    -  This topic was modified 2 years ago by [hugofant](https://wordpress.org/support/users/hugofant/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fhow-to-upload-image-in-post-form%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Support [Williams – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport3/)
 * (@wpmudevsupport3)
 * [2 years ago](https://wordpress.org/support/topic/how-to-upload-image-in-post-form/#post-17702914)
 * Hi [@hugofant](https://wordpress.org/support/users/hugofant/),
 * Hope this message finds you well.
 * Well, mapping or adding images to a Custom Post using [Post Data Field](https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#post-data-field),
   it doesn’t work, this issue has been previously reported, but, I am afraid we
   are unable to provide an ETA for the fix.
 * As workaround, if you are using ACF, our Second Line Support has created this
   mu-plugin as a temporal fix:
 * [https://gist.github.com/wpmudev-sls/9f1a22896e7318dd26d06872b8467419#file-wpmudev-upload-mapping-custom-field-php](https://gist.github.com/wpmudev-sls/9f1a22896e7318dd26d06872b8467419#file-wpmudev-upload-mapping-custom-field-php)
 * You need to update these lines:
 * Replace 4126, 2910 with your form IDs in this line:
 * `$form_ids = array( 4126, 2910 ); //Please change form IDs to your form IDs`
 * Replace test_image with your Custom Field on this line:
 * `if ( $post_val['key'] == 'test_image' ) { //Please change test_image to your
   custom field name`
 * About the editor, is currently not possible either.
 * Let us know the results.
 * Best regards,
    Laura
 *  Plugin Support [Williams – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport3/)
 * (@wpmudevsupport3)
 * [2 years ago](https://wordpress.org/support/topic/how-to-upload-image-in-post-form/#post-17721307)
 * Hi,
 * We haven’t heard from you in a while, I’ll go and mark this thread as resolved.
   Note that you can still reply on this topic.
 * If you have any additional questions or require further help, please let us know!
 * Best regards,
    Laura
 *  Thread Starter [hugofant](https://wordpress.org/support/users/hugofant/)
 * (@hugofant)
 * [1 year, 12 months ago](https://wordpress.org/support/topic/how-to-upload-image-in-post-form/#post-17735663)
 * Hi,
   took some days, as i was not familiar with ACF.in the meantime i’ve installed
   it and i think i understood the way it works.I’ve also installed/activated the
   mu-plugin and entered my form ids and field name:
 *     ```wp-block-code
       $form_ids = array( 678 ); //Please change form IDs to your form IDs
       ```
   
 *     ```wp-block-code
                   if ( $post_val['key'] == 'upload-1' ) { //Please change test_image to your custom field name
       ```
   
 * as this is not working, i’m not sure if this is the correct way to link them 
   together.
   A short description would be helpfull.Thanks in advance and best regardsHugofant
    -  This reply was modified 1 year, 12 months ago by [hugofant](https://wordpress.org/support/users/hugofant/).
      Reason: additional info
 *  Thread Starter [hugofant](https://wordpress.org/support/users/hugofant/)
 * (@hugofant)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/how-to-upload-image-in-post-form/#post-17737449)
 * two additional questions:
   i’ve found your suggested solution [here](https://wpmudev.com/forums/topic/forminator-pro-i-would-like-to-include-two-images-files-in-my-form-and-automatically-attach-it-t/).
   There’s written: its a bug and it’s expected to be fixed with one of nearest 
   upcoming releases.As this info is from Jan 20, 2023, more than a year in the 
   past, has this bug still not been fixed?and as there’s also written: “…and then
   put custom field name (may it be ACF or just regular custom field…” – do i really
   have to install/use ACF?…and as there were already some releases in the meantime–
   is this “workaround” still working/up-to-date?best regardsHugofant
    -  This reply was modified 1 year, 11 months ago by [hugofant](https://wordpress.org/support/users/hugofant/).
      Reason: additional info
    -  This reply was modified 1 year, 11 months ago by [hugofant](https://wordpress.org/support/users/hugofant/).
      Reason: typo
 *  Plugin Support [Laura – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support8/)
 * (@wpmudev-support8)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/how-to-upload-image-in-post-form/#post-17738048)
 * Hi [@hugofant](https://wordpress.org/support/users/hugofant/)
 * It seems there’s been some confusion here and I’m sorry about that. Let me address
   it:
 * 1. the old ticket about the bug that you found – that’s not an issue. You can
   map uploaded images to custom fields.
 * The only “catch” here is that you must make sure about two requirements:
 * a) the “upload” field needs to be of “single” type and not multiple; if you want
   to add multiple images they need to have separate upload fields on the form, 
   all set to “single” and they need to be mapped to separate custom fields
 * b) and “upload” field should have the option to store image in Media Library 
   enabled in settings.
 * 2. If you get that set, it’s pretty easy:
    – enable “custom fields” option in“
   postdata” field – put some label name in custom field “label” – and select your
   upload field as custom field “value”
 * And that’s it. Once you submit the form with image uploaded that image will be
   added as custom field.
 * You do not need ACF for that. WordPress supports simple custom fields out of 
   the box.
 * However, since the images are added as custom fields’ values it’s up to you how
   to display them in post. They won’t be displayed automatically out of the box
   and displaying values of custom fields in front-end is not really related to 
   Formiantor.
 * This can be done with a code in custom template file of the child theme, with
   a custom shortcode or using a free plugin like this one (or similar):
 * [https://wordpress.org/plugins/shortcode-to-display-post-and-user-data/](https://wordpress.org/plugins/shortcode-to-display-post-and-user-data/)
 * Best regards,
    Adam
 *  Thread Starter [hugofant](https://wordpress.org/support/users/hugofant/)
 * (@hugofant)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/how-to-upload-image-in-post-form/#post-17738186)
 * Hi Adam,
   i don’t understand. I’ve the same request as described in the “bug”…
   you’ve sent me the same solution…There’s written: _its a bug and it’s expected
   to be fixed with one of nearest upcoming releases._and also:_Due to the bug, 
   this mapping is currently not passing URL from upload field to the mapped custom
   post and that’s why it’s not working for you._So has it been fixed in the meantime
   and is it working now or not?…and as you can see in my first post, i’ve already
   tried the way via custom field in the post data field:_**then i realized that
   i can link an the “upload field” to “custom field” in the “Post Data” field….**
   _Actually i’m using an “add post” form in Forminator. So my expectation is, when
   adding an “image upload” to the post data field (also via custom field), that
   the image will be displayed within the post afterwards…not on a specific position,
   but at least at the end of the post or as an “attachment”/link.From my point 
   of view it doesn’t make sense to upload an image when it will not be show afterwards.
   So, simple question: Is it really not possible to display images in a post automatically,
   when creating post with the “add post” form of Forminator?Can’t really believe
   this, as for example the plugin Postie can handle this without any problem…Thanks
   and best regardsHugofant
 *  Plugin Support [Laura – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support8/)
 * (@wpmudev-support8)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/how-to-upload-image-in-post-form/#post-17738279)
 * Hi [@hugofant](https://wordpress.org/support/users/hugofant/)
 * > I’ve the same request as described in the “bug”…you’ve sent me the same solution…
   > 
   > There’s written: its a bug and it’s expected to be fixed with one of nearest
   > upcoming releases.
 * Bug was that upload fields could not be mapped to custom fields at all. This 
   is no longer the case.
 * What was not possible directly (and still is not) is that those images can’t 
   directly be injected into post content. That’s lack of the feature though, not
   a bug.
 * > Due to the bug, this mapping is currently not passing URL from upload field
   > to the mapped custom post and that’s why it’s not working for you.
   >  So has 
   > it been fixed in the meantime and is it working now or not?
 * Fixed.
 * > that the image will be displayed within the post afterwards…not on a specific
   > position, but at least at the end of the post or as an “attachment”/link.
   >  
   > From my point of view it doesn’t make sense to upload an image when it will
   > not be show afterwards.
 * I understand it but please note that how the post and its content, including 
   custom fields, is displayed on site has literally nothing to do with Forminator.
   It’s strictly and only related to how your theme works (or theme and other plugins
   related to layout/design).
 * You can add upload field to the form. You can map it to custom field. This will
   save uploaded image URL in custom field. That’s it.
 * How you display the post and its data (including custom posts) doesn’t related
   on it.
 * —-
 * As I mentioned earlier, one of the simplest solution is to use the plugin that
   I suggested earlier and just put shortcode to display that custom field value
   in the post.
 *  Thread Starter [hugofant](https://wordpress.org/support/users/hugofant/)
 * (@hugofant)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/how-to-upload-image-in-post-form/#post-17748668)
 * Hi Adam,
   sorry to bother you again, but i’ve tested the suggested solution and
   there is still a problem.The method generally works. i can see at least the pictures
   in the single post site but when looking into the media library the images are
   show as “unattached”. Think this will result i a big mess after a few months.
   Is there a solution for that, or have i done something wrong?
 *  Plugin Support [Dmytro – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport16/)
 * (@wpmudevsupport16)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/how-to-upload-image-in-post-form/#post-17749556)
 * Hello Hugofant,
 * There’s currently no option to attach uploaded files to posts out of the box,
   but we have a feature request for the developers to consider implementing this.
   There’s no ETA though, I’m afraid.
 * In order to make sure that we understand your current setup correctly, could 
   you please confirm, if you are using regular custom fields for the image paths,
   and not ACF?
 * You are using [this plugin](https://wordpress.org/plugins/shortcode-to-display-post-and-user-data/)
   for displaying images – is that right?
 * We just need to confirm the above first, to check for possible workarounds.
    
   Looking forward to your reply!
 * Best Regards,
    Dmytro
 *  Thread Starter [hugofant](https://wordpress.org/support/users/hugofant/)
 * (@hugofant)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/how-to-upload-image-in-post-form/#post-17749620)
 * yes, i’m using only Forminator (custom fields within the post data field) and
   the mentioned plugin.
   best regardsHugofant
 *  Plugin Support [Laura – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support8/)
 * (@wpmudev-support8)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/how-to-upload-image-in-post-form/#post-17750398)
 * Hi [@hugofant](https://wordpress.org/support/users/hugofant/)
 * Thanks for confirmation!
 * Images being “unattached” is actually expected in such case.
 * An “attached” image is an image that is a “featured image” or image that’s injected
   into post content. Custom field is just a, so to say, “db record” with some data
   and in general – images that are added to custom fields are not marked as “attached”
   by WordPress core.
 * They’d need to be specifically set to be attached by the code but since Forminator
   does not yet handle injecting images into posts (as mentioned by my colleague
   above), it is not happening. All it does is only putting data from the form field
   into the custom field.
 * Kind regards,
    Adam

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

The topic ‘how to upload image in post form?’ is closed to new replies.

 * ![](https://ps.w.org/forminator/assets/icon-256x256.gif?rev=3443182)
 * [Forminator Forms – Contact Form, Payment Form & Custom Form Builder](https://wordpress.org/plugins/forminator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/forminator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/forminator/)
 * [Active Topics](https://wordpress.org/support/plugin/forminator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/forminator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/forminator/reviews/)

 * 11 replies
 * 4 participants
 * Last reply from: [Laura – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support8/)
 * Last activity: [1 year, 11 months ago](https://wordpress.org/support/topic/how-to-upload-image-in-post-form/#post-17750398)
 * Status: resolved