• Resolved Bryan Willis

    (@codecandid)


    I can’t get the file upload field to work. I just get errors in the Dev Console and the form submit button gets the “Circle Loading” icon that never goes away.

    It works when I’m logged in which is strange, but when logged out it doesn’t work.

    I’m using formadible pro and have most of the plugins installed.

    
     Uncaught SyntaxError: Unexpected token < in JSON at position 0
        at JSON.parse (<anonymous>)
        at Function.n.parseJSON (jquery.js?ver=1.12.4:4)
        at Function.a.parseJSON (jquery-migrate.min.js?ver=1.4.1:2)
        at d.<anonymous> (formidablepro.min.js?ver=3.03:8)
        at d.value (dropzone.min.js?ver=4.3.0:3)
        at d.value (dropzone.min.js?ver=4.3.0:61)
        at d.value (dropzone.min.js?ver=4.3.0:60)
        at XMLHttpRequest.f.onload (dropzone.min.js?ver=4.3.0:54)
    

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Bryan Willis

    (@codecandid)

    So I figured out what the problem was after some trial and error.

    I had a deprecated function ‘get_currentuserinfo()’ that I had put into my theme a few years back to disable access to the admin for people without a high enough user level…

    
    function restrict_access_admin_panel(){
                    global $current_user;
                    get_currentuserinfo();
                    if ($current_user->user_level <  4) {
                            wp_redirect( get_bloginfo('url') );
                            exit;
                    }
            }
    add_action('admin_init', 'restrict_access_admin_panel', 1);
    

    Anyway, I removed it and all was fixed. Not sure if it was ‘get_currentuserinfo()’ that was causing the issue or possibly the outdated function in general. I’m thinking maybe admin_init gets ran when performing an upload with Formidable and it says that the logged out user is not at high enough level. I’m curious though why I never ran into this problem with Gravity Forms or another plugin that uploads files…

    Plugin Author Steph Wells

    (@sswells)

    Hi Bryan,

    The problem was that the error message for your custom code were being returned in the javascript, which corrupts the json response. Thanks for looking into your issue and letting us know the solution!

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

The topic ‘Error with file upload’ is closed to new replies.