Home › Forums › Quform WordPress › Media uploads not showing in media browser
- This topic has 4 replies, 2 voices, and was last updated 5 years, 11 months ago by Ally.
- AuthorPosts
- April 18, 2018 at 2:23 am #25062ghostedParticipant
Hi Ally,
I found previous topics that asked this question that referred to adding code to the theme functions.php file, specifically :function my_uploads_to_media_library($form)
{
$files = (array) $form->getValue(‘iphorm_1_1’);foreach ($files as $file) {
$filename = $file[‘text’];
$path = $file[‘fullPath’];$wp_filetype = wp_check_filetype($filename, null);
$attachment = array(
‘guid’ => $file[‘url’],
‘post_mime_type’ => $wp_filetype[‘type’],
‘post_title’ => preg_replace(‘/\.[^.]+$/’, ”, $filename),
‘post_content’ => ”,
‘post_status’ => ‘inherit’
);$attach_id = wp_insert_attachment($attachment, $path);
require_once ABSPATH . ‘wp-admin/includes/image.php’;
$attach_data = wp_generate_attachment_metadata($attach_id, $path);
wp_update_attachment_metadata($attach_id, $attach_data);
}
}
add_action(‘iphorm_post_process_1’, ‘my_uploads_to_media_library’);However this doesn’t seem to work. The files are being sent to the correct folder on my server just not showing up in my media folder.
My form ID is 1 and the unique id (of the field) is 1_23. I noticed this post was from some time ago and the solution may apply to Quform 1 not 2. Should this still work?
If this is still correct, should the getvalue ID be “iphorm_1_23”
add_action(‘iphorm_post_process_1) would be correct too because 1 is the id of the form, correct?Thanks for your help
April 23, 2018 at 12:07 pm #25108AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
April 23, 2018 at 7:10 pm #25131ghostedParticipantThanks Ally,
The media does upload and show in the media browser now, but on the front end submission form i’m getting“There was a problem
The response from the server was invalid or malformed”I only get this when there is an actual media upload, if i submit a form with out an attachment I don’t get that error.
Any idea what could be causing that?
Thanks again for your help!
April 23, 2018 at 8:43 pm #25133AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
April 25, 2018 at 3:23 pm #25244AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.