Media uploads not showing in media browser

Home Forums Quform WordPress Media uploads not showing in media browser

This topic is: not resolved
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #25062
    ghosted
    Participant

    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

    #25108
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #25131
    ghosted
    Participant

    Thanks 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!

    #25133
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #25244
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy