Formilator – Upload File doesnt work
-
Hello,
im working in localhost on my website and installed forminator.
everythings works fine except the file upload.
if i send the formular my post will be createt with these informations:
as you can see the thumbnail and file fields are totally empty.
i found this code:<?php add_filter( 'forminator_prepared_data', 'wpmudev_map_uplods_acf_post', 10, 2 ); function wpmudev_map_uplods_acf_post( $prepared_data, $module_object ) { if( $prepared_data['form_id'] != 2101 ){ return $prepared_data; } if( isset( $prepared_data['postdata-1'] ) && is_array( $prepared_data['postdata-1'] ) ) { if( isset( $prepared_data['postdata-1']['post-custom'] ) && is_array( $prepared_data['postdata-1']['post-custom'] ) ) { foreach( $prepared_data['postdata-1']['post-custom'] as $post_key => $post_val ) { if( strpos( $post_val['value'], '{upload' ) !== false ) { $field_name = str_replace('{', '', $post_val['value'] ); $field_name = str_replace('}', '', $field_name ); if ( is_array( $prepared_data[ $field_name ] ) && isset( $prepared_data[ $field_name ]['file'] ) ) { $prepared_data['postdata-1']['post-custom'][$post_key]['value'] = attachment_url_to_postid( $prepared_data[ $field_name ]['file']['file_url'] ); } } } } } return $prepared_data; } ?>which will result to this:

i can get it working when forminator can provide me the file url in the post costum data field.
any ideas?
also heres my forminator form becasue im working local.
{"type":"form","data":{"fields":[{"id":"postdata-1","element_id":"postdata-1","form_id":"wrapper-1511347711918-1669","parent_group":"","type":"postdata","cols":"12","data_status":"publish","post_title_label":"Post Title","post_content_label":"Post Content","post_excerpt_label":"Post Excerpt","post_image_label":"Featured Image","category_label":"Category","post_tag_label":"Tags","select_author":"1","category_multiple":"0","post_tag_multiple":"0","post_type":"community-resources","post_title":"1","post_content":"1","category":"1","post_image":"","options":[{"label":"thumbnail_main","value":"{upload-1}"},{"label":"thumbnail_second","value":"{upload-2}"},{"label":"thumbnail_third","value":"{upload-3}"},{"label":"model_maker","value":"{select-1}"},{"label":"texture_maker","value":"{select-2}"},{"label":"animator","value":"{select-3}"},{"label":"quality","value":"{checkbox-1}"},{"label":"model_type","value":"{checkbox-2}"},{"label":"resources_type","value":"{checkbox-3}"},{"label":"animated","value":"{checkbox-4}"},{"label":"file","value":"{upload-4}"}],"wrapper_id":"wrapper-1511347711918-1669","value":"{upload-4}","post_custom_fields":"1","post_tag":"1","required":"1","conditions":[],"required_message":"Please enter the desired information!","post_excerpt":""},{"id":"upload-1","element_id":"upload-1","form_id":"wrapper-8541-3218","parent_group":"","type":"upload","options":[],"cols":"4","conditions":[],"wrapper_id":"wrapper-8541-3218","field_label":"Main Thumbnail","filetypes":["all-image","jpg|jpeg|jpe","gif","png","bmp","tiff|tif","webp","ico","heic","htm|html","js","psd","xcf","w3x","svg","svgz"],"file-type":"single","file-limit":"unlimited","upload-limit":"150","filesize":"KB","required":"1","required_message":"You need to upload at least one Thumbnail!","description":"Upload the main Thumbnail!","use_library":"true","custom-files":"1"},{"id":"upload-2","element_id":"upload-2","form_id":"wrapper-8541-3218","parent_group":"","type":"upload","options":[],"cols":"4","conditions":[],"wrapper_id":"wrapper-8541-3218","field_label":"Secondary Thumbnail","filetypes":["webp","htm|html","js","w3x","svg","svgz","all-image","jpg|jpeg|jpe","all-image","gif","all-image","png","all-image","bmp","all-image","tiff|tif","all-image","ico","all-image","psd","all-image","xcf","all-image","heic"],"file-type":"single","file-limit":"unlimited","upload-limit":"150","filesize":"KB","required":"","required_message":"You need to upload at least one Thumbnail!","description":"Upload the secondary Thumbnail!","formid":"wrapper-7311-8154","use_library":"","custom-files":"1"},{"id":"upload-3","element_id":"upload-3","form_id":"wrapper-8541-3218","parent_group":"","type":"upload","options":[],"cols":"4","conditions":[],"wrapper_id":"wrapper-8541-3218","field_label":"Third Thumbnail","filetypes":["all-image","jpg|jpeg|jpe","gif","png","bmp","tiff|tif","webp","ico","heic","htm|html","js","psd","xcf","w3x","svg","svgz"],"file-type":"single","file-limit":"unlimited","upload-limit":"150","filesize":"KB","required":"","required_message":"You need to upload at least one Thumbnail!","description":"Upload the third Thumbnail!","formid":"wrapper-8353-6885","use_library":"","custom-files":"1"},{"id":"select-1","element_id":"select-1","form_id":"wrapper-5910-6230","parent_group":"","type":"select","options":[{"key":"7426-2625","label":"Not Known","value":"Not Known","default":"","error":""}],"cols":"4","conditions":[],"wrapper_id":"wrapper-5910-6230","hidden_behavior":"zero","value_type":"single","field_label":"Model Maker","options_bulk_editor":"Not Known","placeholder":"Select the model maker if available.","options_expanded":"","bulk_edit":"","required":"","required_message":"Select the model maker if available."},{"id":"select-2","element_id":"select-2","form_id":"wrapper-5910-6230","parent_group":"","type":"select","options":[{"key":"7426-2625","label":"Not Known","value":"Not Known","default":"","error":""}],"cols":"4","conditions":[],"wrapper_id":"wrapper-5910-6230","hidden_behavior":"zero","value_type":"single","field_label":"Texture made by:","options_bulk_editor":"Not Known","placeholder":"Select the texture maker if available.","options_expanded":"","bulk_edit":"","formid":"wrapper-6169-9935","required":"1","required_message":"Select the texture maker if available."},{"id":"select-3","element_id":"select-3","form_id":"wrapper-5910-6230","parent_group":"","type":"select","options":[{"key":"7426-2625","label":"Not Known","value":"Not Known","default":"","error":""}],"cols":"4","conditions":[],"wrapper_id":"wrapper-5910-6230","hidden_behavior":"zero","value_type":"single","field_label":"Animations made by:","options_bulk_editor":"Not Known","placeholder":"Select the animator if available.","options_expanded":"","bulk_edit":"","formid":"wrapper-7540-3127","required":"","required_message":"Select the animator if available."},{"id":"checkbox-3","element_id":"checkbox-3","form_id":"wrapper-4820-4628","parent_group":"","type":"checkbox","options":[{"label":"SFX","value":"sfx","key":"8023-6898","error":""},{"label":"Sound","value":"sound","key":"3368-3517","error":""},{"label":"Icon","value":"icon","limit":"","default":"","key":"7178-3050","error":""},{"label":"Texture","value":"texture","limit":"","default":"","key":"2381-7126","error":""},{"label":"Model","value":"model","limit":"","default":"","key":"1267-2123","error":""},{"label":"Doodad","value":"doodad","limit":"","default":"","key":"5447-7085","error":""}],"cols":"3","conditions":[],"wrapper_id":"wrapper-4820-4628","hidden_behavior":"zero","value_type":"checkbox","field_label":"Resources Type","layout":"vertical","options_bulk_editor":"SFX;sfx; 0\nSound;sound; 0\nIcon;icon; 0\nTexture;texture; 0\nModel;model; 0\nDoodad;doodad; 0","options_expanded":"1","required":"","required_message":"Please select the resource type!"},{"id":"checkbox-2","element_id":"checkbox-2","form_id":"wrapper-4820-4628","parent_group":"","type":"checkbox","options":[{"label":"Character","value":"character","key":"8023-6898","error":""},{"label":"Building","value":"building","key":"3368-3517","error":""},{"label":"Terrain","value":"terrain","limit":"","default":"","key":"1378-9095","error":""}],"cols":"3","conditions":[{"element_id":"checkbox-3","rule":"is","value":"model"}],"wrapper_id":"wrapper-4820-4628","hidden_behavior":"zero","value_type":"checkbox","field_label":"Model Type","layout":"vertical","options_bulk_editor":"Character;character; 0\nBuilding;building; 0\nTerrain;terrain; 0","options_expanded":"1","condition_rule":"all","required":"","required_message":"Please select the model type!"},{"id":"checkbox-4","element_id":"checkbox-4","form_id":"wrapper-4820-4628","parent_group":"","type":"checkbox","options":[{"label":"Animated","value":"animated","key":"8023-6898","error":""},{"label":"Unanimated","value":"unanimated","key":"3368-3517","error":""}],"cols":"3","conditions":[{"element_id":"checkbox-3","rule":"is","value":"model"},{"element_id":"checkbox-3","rule":"is","value":"doodad"}],"wrapper_id":"wrapper-4820-4628","hidden_behavior":"zero","value_type":"checkbox","field_label":"Animated","layout":"vertical","options_bulk_editor":"Animated;animated; 0\nUnanimated;unanimated; 0","options_expanded":"1","condition_rule":"any","required":"","required_message":"Please let us know if the model is animated or not."},{"id":"checkbox-1","element_id":"checkbox-1","form_id":"wrapper-4820-4628","parent_group":"","type":"checkbox","options":[{"label":"HQ","value":"HQ","key":"8023-6898","error":""},{"label":"LQ","value":"LQ","key":"3368-3517","error":""}],"cols":"3","conditions":[],"wrapper_id":"wrapper-4820-4628","hidden_behavior":"zero","value_type":"checkbox","field_label":"Quality","layout":"vertical","options_bulk_editor":"HQ;HQ; 0\nLQ;LQ; 0","options_expanded":"1","enable_images":"","required":"","required_message":"Please let us know what the quality of the resource is."},{"id":"upload-4","element_id":"upload-4","form_id":"wrapper-1894-6492","parent_group":"","type":"upload","options":[],"cols":"12","conditions":[],"wrapper_id":"wrapper-1894-6492","field_label":"Upload file","filetypes":["all-archive","webp","htm|html","js","tar","zip","gz|gzip","rar","7z","w3x","svg","svgz"],"file-type":"single","file-limit":"unlimited","upload-limit":"8","filesize":"MB","required":"1","use_library":"","custom-files":"1"}],"settings":{"pagination-header":"nav","paginationData":{"pagination-header-design":"show","pagination-header":"nav"},"formName":"Community Resource","version":"1.23.3","form-border-style":"none","form-padding":"custom","form-border":"custom","fields-style":"open","validation":"on_submit","akismet-protection":"0","form-style":"flat","enable-ajax":"true","autoclose":"true","submission-indicator":"show","indicator-label":"Submitting...","form-type":"default","submission-behaviour":"behaviour-thankyou","thankyou-message":"Thank you. Your post has been submitted.","submitData":{"custom-submit-text":"Create Post","custom-invalid-form-message":"Error: Your form is not valid, please fix the errors!"},"validation-inline":"1","form-expire":"no_expire","form-padding-top":"60","form-padding-right":"60","form-padding-bottom":"60","form-padding-left":"60","form-border-width":"2","form-border-radius":"11","cform-label-font-family":"Roboto","cform-label-custom-family":"","cform-label-font-size":"12","cform-label-font-weight":"bold","cform-title-font-family":"Roboto","cform-title-custom-family":"","cform-title-font-size":"45","cform-title-font-weight":"normal","cform-title-text-align":"left","cform-subtitle-font-family":"Roboto","cform-subtitle-custom-font":"","cform-subtitle-font-size":"18","cform-subtitle-font-weight":"normal","cform-subtitle-text-align":"left","cform-input-font-family":"Roboto","cform-input-custom-font":"","cform-input-font-size":"16","cform-input-font-weight":"normal","cform-radio-font-family":"Roboto","cform-radio-custom-font":"","cform-radio-font-size":"14","cform-radio-font-weight":"normal","cform-select-font-family":"Roboto","cform-select-custom-family":"","cform-select-font-size":"16","cform-select-font-weight":"normal","cform-multiselect-font-family":"Roboto","cform-multiselect-custom-font":"","cform-multiselect-font-size":"16","cform-multiselect-font-weight":"normal","cform-dropdown-font-family":"Roboto","cform-dropdown-custom-font":"","cform-dropdown-font-size":"16","cform-dropdown-font-weight":"normal","cform-calendar-font-family":"Roboto","cform-calendar-custom-font":"","cform-calendar-font-size":"13","cform-calendar-font-weight":"normal","cform-button-font-family":"Roboto","cform-button-custom-font":"","cform-button-font-size":"14","cform-button-font-weight":"500","cform-timeline-font-family":"Roboto","cform-timeline-custom-font":"","cform-timeline-font-size":"12","cform-timeline-font-weight":"normal","cform-pagination-font-family":"","cform-pagination-custom-font":"","cform-pagination-font-size":"16","cform-pagination-font-weight":"normal","payment_require_ssl":"","submission-file":"keep","store_submissions":"1","form_name":"community-resource","form_status":"publish","cform-color-settings":"true","response-loading-color":"#333333","response-success-border":"#a02d2a","response-success-background":"#a0605d","response-error-border":"#a02d2a","response-error-background":"#a06b66","cform-asterisk-color":"#a02d2a","label-validation-background":"#a06c66","label-validation-color":"#a02d2a","input-border-hover":"#a02d2a","input-border-active":"#a02d2a","input-border-error":"#a02d2a","input-color":"#202020","input-hover-color":"#202020","input-active-color":"#202020","radio-label":"#ffffff","radio-icon":"#a02d2a","radio-border-active":"#a02d2a","radio-border-error":"#a02d2a","select-border-hover":"#a02d2a","select-icon-hover":"#a02d2a","select-value-hover":"#ffffff","select-border-active":"#a02d2a","select-icon-active":"#a02d2a","select-value-active":"#ffffff","select-border-error":"#a02d2a","dropdown-border":"#a02d2a","dropdown-option-color-hover":"#ffffff","dropdown-option-background-hover":"#a02d2a","dropdown-option-background-active":"#a02d2a","dropdown-background":"#111111","dropdown-option-color-static":"#ffffff","button-upload-background-static":"#a02d2a","button-upload-background-hover":"#a05753","button-upload-background-active":"#a02d2a","button-upload-delete-color-static":"#a02d2a","button-upload-delete-color-hover":"#a02d2a","button-upload-delete-background-hover":"#a0726e","button-upload-delete-color-active":"#a02d2a","button-upload-delete-background-active":"#a07e7b","button-submit-background-static":"#a02d2a","button-submit-background-hover":"#a02d2a","button-submit-background-active":"#a02d2a","cform-form-background":"#111111","cform-form-border":"#202020","field-border":"custom","field-border-radius":"11","field-border-width":"2","sc_email_link":"1","sc_message":"<p>Your form has been saved as draft and a resume link has been generated so you can return to the form anytime within {retention_period} days from today. Copy and save the link or enter your email address below to have the link sent to your mail.<\/p><p>These fields weren't saved to your submission draft: Paypal, Stripe, Signature, Password, Captcha, and Upload. Kindly fill them out before submitting the form.<\/p>","print_value":"false","enable-submissions-retention":"false","logged-users":"","honeypot":"1","use_ajax_load":"1"},"client_id":"","integration_conditions":[],"behaviors":[{"slug":"behavior-1234-4567","label":"","autoclose-time":"5","autoclose":"true","newtab":"sametab","thankyou-message":"Thank you. Your post has been submitted.","email-thankyou-message":"","manual-thankyou-message":"","submission-behaviour":"behaviour-thankyou","redirect-url":""}],"notifications":[{"slug":"notification-1234-4567","label":"Admin Email","email-recipients":"default","recipients":"[email protected]","email-subject":"New Form Entry #{submission_id} for {form_name}","email-editor":"You have a new website form submission: <br \/> {all_fields} <br \/>---<br \/> This message was sent from {site_url}.","email-attachment":"true","type":"default","conditions":[]}]},"status":"publish","version":"1.23.3"}
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Formilator – Upload File doesnt work’ is closed to new replies.