Support » Fixing WordPress » Can´t upload images “An error occurred in the upload. Please try again lat

  • Hello There!

    • Developing on own computer MAMP
    • Using home-made child-theme to twentyseventeen
    Customized template files in child theme folder:
    style.css
    functions.php
    home.php
    front-page.php
    fullwidth.php
    content.php
    content-link.php
    content-image.php
    content-aside.php

    • Description of problem:

    I have been dealing with the issue “An Error Occurred In The Upload. Please Try Again Later” for about two weeks now and I´m a beginner of wordpress.

    • What I have tried so far:

    1. I tried to go though my code in each child theme and change the file name so that wordpress will follow the parent theme(twentyseventeen instead). But for me I didnt see any errors that I know of.

    2. Been checking for “file permission” but my laptop that is windows I didnt found the option for “file permission” that idéa also disappear after we knew it were something in my child theme code that might be the problem.

    3. Made a copy on my child theme and activated that instead still the same problem

    4. In the default parent twentyseventeen if i activated that all my images did upload like normal(thats why we noticed the problem would be in my child theme).

    5. We tried to write WP-DEBUG = true in the wp-config.php no sucess and I changed it back.

    6. I have heard of the plugin “health-check” but before I activated it we figured out in another forum that the problem is in the Child Theme that I used and not on the default wordpress parent Twentyseventeen, so the mod from the forum told me it was no use to use the health-check because it will just look in the programmes/plugins itself and not see the problems in my child theme. Is that correct?

    I used the guide from this link:
    https://sebastian.expert/fix-wordpress-an-error-occurred-in-the-upload-please-try-again-later/
    and when I tried to upload an image I went under the “async_upload.php” and it show me:

    <!– how to make wordpress connect with your style.css
    wp_enqueue_style = grab a stylesheet somewhere from the theme folder, place it in the head section of the HTML that is output when the theme render on the front end of the site
    another option to import the style is by @import url write in which folder and style.css which can be used when it is not an advanced theme parent to work with but I picked the wp:enqueue_style metod for my dog-theme, both the metods have different opinion of use–>

    <!– Testade med att fixa till post formats i min blogg –>

    {“success”:true,”data”:{“id”:225,”title”:”IMG_4869″,”filename”:”IMG_4869-5.jpg”,”url”:”http:\/\/localhost\/wordpress\/wp-content\/uploads\/2018\/10\/IMG_4869-5.jpg”,”link”:”http:\/\/localhost\/wordpress\/img_4869-6\/”,”alt”:””,”author”:”1″,”description”:””,”caption”:””,”name”:”img_4869-6″,”status”:”inherit”,”uploadedTo”:0,”date”:1540832635000,”modified”:1540832635000,”menuOrder”:0,”mime”:”image\/jpeg”,”type”:”image”,”subtype”:”jpeg”,”icon”:”http:\/\/localhost\/wordpress\/wp-includes\/images\/media\/default.png”,”dateFormatted”:”October 29, 2018″,”nonces”:{“update”:”a2949d22b0″,”delete”:”2534707dca”,”edit”:”ce8003b48e”},”editLink”:”http:\/\/localhost\/wordpress\/wp-admin\/post.php?post=225&action=edit”,”meta”:false,”authorName”:”A nice site about doggies”,”filesizeInBytes”:1398997,”filesizeHumanReadable”:”1 MB”,”context”:””,”height”:3264,”width”:2448,”orientation”:”portrait”,”sizes”:{“thumbnail”:{“height”:150,”width”:150,”url”:”http:\/\/localhost\/wordpress\/wp-content\/uploads\/2018\/10\/IMG_4869-5-150×150.jpg”,”orientation”:”landscape”},”medium”:{“height”:300,”width”:225,”url”:”http:\/\/localhost\/wordpress\/wp-content\/uploads\/2018\/10\/IMG_4869-5-225×300.jpg”,”orientation”:”portrait”},”large”:{“height”:700,”width”:525,”url”:”http:\/\/localhost\/wordpress\/wp-content\/uploads\/2018\/10\/IMG_4869-5-768×1024.jpg”,”orientation”:”portrait”},”full”:{“url”:”http:\/\/localhost\/wordpress\/wp-content\/uploads\/2018\/10\/IMG_4869-5.jpg”,”height”:3264,”width”:2448,”orientation”:”portrait”}},”compat”:{“item”:””,”meta”:””}}}

    The first is comment in english by me, second comment I did in swedish, code that I tested with post format but even if I take away that test code it doesnt work as normal.

    As you can see it doesnt say false here : {“success”:true,”data”:

    but it says false when it come to “meta”:false,”authorName”:”A nice site about doggies”, which was my authorname when I first started wordpress

    I didnt continue with the guide since it said “true” for me with the “data”.

    I may have tried out more things but I´m out of ideas and I would really appreciate some help

    Thanks in Advance

    • This topic was modified 1 year, 11 months ago by dragoness390.
Viewing 3 replies - 1 through 3 (of 3 total)
  • If it is only happening in the child theme I would guess there is a typo or other mistake in your child functions.php file. Can you post the code or link to git?

    functions.php

    <!– how to make wordpress connect with your style.css
    wp_enqueue_style = grab a stylesheet somewhere from the theme folder, place it in the head section of the HTML that is output when the theme render on the front end of the site
    another option to import the style is by @import url write in which folder and style.css which can be used when it is not an advanced theme parent to work with but I picked the wp:enqueue_style metod for my dog-theme, both the metods have different opinion of use–>

    <?php
    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
    function my_theme_enqueue_styles() {
     
        $parent_style = 'parent-style';
     
        wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'child-style',
            get_stylesheet_directory_uri() . '/style.css',
            array( $parent_style ),
            wp_get_theme()->get('Version')
        );
    }
    ?>

    I didnt thought you could have a wordpress project in git

    Do you want me to take out the code from the other child files here as well?

    • This reply was modified 1 year, 11 months ago by dragoness390.

    The error is resolved so this topic can be closed

    How to resolve it:

    Check in the functions.php file that you dont have any space below or under your code, a comment I had was the problem

    Wrote <?php before the comment:

    <?php 
    
    /*how to make wordpress connect with your style.css 
    wp_enqueue_style = grab a stylesheet somewhere from the theme folder, place it in the head section of the HTML that is output when the theme render on the front end of the site
    another option to import the style is by @import url write in which folder and style.css which can be used when it is not an advanced theme parent to work with but I picked the wp:enqueue_style metod for my dog-theme, both the metods have different opinion of use */
    
    add_action( 'wp_enqueue_scripts', 'dog_theme_enqueue_styles' );
    function dog_theme_enqueue_styles() {
     
        $parent_style = 'parent-style';
     
        wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'child-style',
            get_stylesheet_directory_uri() . '/style.css',
            array( $parent_style ),
            wp_get_theme()->get('Version')
        );
    }
    
    ?>

    I also took ?php and end it with ?>(if you have just a comment and html code after, end it staight after the comment)

    Exemple with just a comment:

    <?php
    
    /*if it will be a image format this file will be shown*/
    
    ?>

    Hope it help anyone that have the same problem

    • This reply was modified 1 year, 11 months ago by dragoness390.
    • This reply was modified 1 year, 11 months ago by dragoness390.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can´t upload images “An error occurred in the upload. Please try again lat’ is closed to new replies.