Bug when uploading images via frontend (add new event form)

  • In Progress
    Posted in: EventBuilder  

  • Member
    March 25, 2016 at 2:00 pm #15112

    Hi Alex,

    There is a bug in the “Add new event” form when you try to upload an image (e.g. cover image) via frontend.

    Firstly I thought it is the well-known and common wordpress bug “An error occurred. Please try again later.” that occurs since years due to different reasons. But it isn’t :-/ It is a theme related bug.

    What I already did and checked:
    – wrong / outdated php version = NO! (php version 5.6.x = latest)
    – outdated wp version = NO! (wordpress 4.2.2 = latest)
    – outdated active plugins = NO! (latest or inactive)
    – too few memory = NO! (32 MB memory set in php.ini)
    – too big images = NO! (uploaded images in all sizes and formats)
    – thumbnail generating problem = NO! (works fine when uploading images via backend)
    – wrong permissions = NO! (folder is set to 755)
    – WP settings -> default not set to “subscriber NO!

    so all common bug fixes I could find in support forums, etc. did not work.

    So I tested it with different user roles and permissions to find out if it is a user role permission issue:

    event_user_level = 0
    event_capabilities = a:1:{s:10:”subscriber”;b:1;}

    event_user_level = 1
    event_capabilities = a:1:{s:11:”contributor”;b:1;}

    event_user_level = 2
    event_capabilities = a:1:{s:6:”author”;b:1;}

    event_user_level = 7
    event_capabilities = a:1:{s:6:”editor”;b:1;}

    event_user_level = 10
    event_capabilities = a:1:{s:13:”administrator”;b:1;}

    As a result = NO! it does not matter if you are a subscriber or administrator (as long as you are not logged in the backend parallel !!!) the image upload via frontend won’t work and you will get the error message:

    “An error occurred. Please try again later.”

    +++ SUMMARY +++
    When you log in e.g. as a subscriber to the wordpress BACKEND you are able to upload images without any problems.

    As long as you are additionally (!) logged in as a subscriber in the BACKEND and will open the FRONTEND in a new tab, you will also be able to upload an image without any problems via frontend and the add an event form.

    As soon as you are NOT logged in in the BACKEND anymore you won’t be able to upload an image via frontend any longer (regardless if you are subscriber, editor or even admin)

    –> so from my point of view the bug has something to do with permissions or maybe the user not being recognized as allowed to upload an image or sth. like this.

    +++ additional information +++
    The registration and also the login works properly and users can also add their events by filling out the corresponding form. The only bug that appears is that they are not able to upload an image.

    By clicking on “upload” the default wordpress media uload lightbox appears and the user can browse an image and click “save” the image seem to be upload (progress bar) but as soon as the upload is complete an error message appears:

    “An error occurred. Please try again later.”

    The uploaded image is not displayed and hasn’t been uploaded.

    I was wondering why this happens and found an article https://sebastian.expert/fix-wordpress-an-error-occurred-in-the-upload-please-try-again-later/ how to find hints what is happening because it must have something to do with “async_upload.php” in wp-admin folder.

    So I used the Chrome Developer Tool (as described in the article) and when uploading an image via frontend there is no repsonse for the async_upload.php in the developer tool. Here is what I get as Header information:
    Request URL:https://www.XXX.de/wp-admin/async-upload.php
    Request Method:POST
    Status Code:302 Moved Temporarily
    Remote Address: XXX.119.53.2:443

    Cache-Control:no-cache, must-revalidate, max-age=0
    Content-Type:text/html; charset=UTF-8
    Date:Fri, 25 Mar 2016 13:24:11 GMT
    Expires:Wed, 11 Jan 1984 05:00:00 GMT

    POST /wp-admin/async-upload.php HTTP/1.1
    Host: http://www.XXX.de
    Connection: keep-alive
    Content-Length: 14773
    Authorization: Basic YWRtaW46aW5nYTA0ZGluYWgwNQ==
    Origin: https://www.XXX.de
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
    Content-Type: multipart/form-data; boundary=—-WebKitFormBoundaryrPkYPrS5zkmBxxGH
    Accept: */*
    Referer: https://www.XXX.de/upload-event/
    Accept-Encoding: gzip, deflate
    Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
    Cookie: wordpress_sec_3c93352d2a6abbad0148f47415696990=admin%7C1454315530%7CjX7FX5ZquuWDzQDNDFqpoxalMaihnnMf3WiK7ABO8NM%7Ce12cf9fd889082c19fec0f52e6bafd1543bce0406371e4471b19bc0fba5b9154; wordpress_logged_in_3c93352d2a6abbad0148f47415696990=admin%7C1454315530%7CjX7FX5ZquuWDzQDNDFqpoxalMaihnnMf3WiK7ABO8NM%7C2d62a56fce54366cb258be7851eef1f1ffeccdb57087aacfb6d2dcaaac330ecb; PHPSESSID=a9138ade709fecdc219f441112efe206; printfriendly-font-class=pf-12; addevent_track_cookie=b5f9ce98-f12a-4dbc-5369-9cfad89ae785; wp-settings-3=libraryContent%3Dbrowse; wp-settings-time-3=1458675941; redux_current_tab_get=14; redux_current_tab=14; wordpress_test_cookie=WP+Cookie+check; wp-settings-1=editor%3Dtinymce%26libraryContent%3Dbrowse%26edit_element_vcUIPanelWidth%3D817%26edit_element_vcUIPanelLeft%3D609px%26edit_element_vcUIPanelTop%3D157px%26template_window_vcUIPanelWidth%3D1536%26template_window_vcUIPanelLeft%3D192px%26template_window_vcUIPanelTop%3D74px%26wplink%3D1%26hidetb%3D1; wp-settings-time-1=1458911542

    I do not understand why I am redirected to wp-login and get an “302 Temporarily redirected” after uploading an image. When taking a look into the async-upload.php there is not such a redirect. So maybe the async-upload.php isn’t loaded correctly when trying to upload an image via FRONTEND ?!

    Best regards,

    Sorry, this forum is for verified users only. Please Login or Register to continue

Comments are closed.