Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating a product always returns woocommerce_product_image_upload_error #56

cdiguy opened this issue Nov 5, 2019 · 1 comment


Copy link

@cdiguy cdiguy commented Nov 5, 2019

I have a custom plugin that creates/updates product pages from information retrieved from an external customer database. The plugin uses the WooCommerce REST API PUT request to update existing product page data. When I updated WooCommerce from ver 3.4.4 to ver 3.7.0 I began to see the following error for all product page updates:

Code: 400
Headers: Array
[Date] => Thu, 31 Oct 2019 17:34:55 GMT
[Server] => Apache/2.2.15 (CentOS)
[X-Powered-By] => PHP/7.2.1
[Set-Cookie] => PHPSESSID=7uo0ufol9pnejka6ru0pvm7sov; path=/
[Expires] => Wed, 11 Jan 1984 05:00:00 GMT
[Cache-Control] => no-transform, no-cache, must-revalidate, max-age=0
[Pragma] => no-cache
[X-Robots-Tag] => noindex
[Link] =>; rel=""
[X-Content-Type-Options] => nosniff
[Access-Control-Expose-Headers] => X-WP-Total, X-WP-TotalPages
[Access-Control-Allow-Headers] => Authorization, Content-Type
[Content-Length] => 159
[Connection] => close
[Content-Type] => application/json; charset=UTF-8
Body: {"code":"woocommerce_product_image_upload_error","message":"Invalid image: Sorry, this file type is not permitted for security reasons.","data":{"status":400}}

Our debug output for one of the product updates:

[31-Oct-2019 17:34:55 UTC] [admin-ajax.php][][][DEBUG] upsert_wc_product called for sku 113-4041
[31-Oct-2019 17:34:55 UTC] [admin-ajax.php][][][DEBUG] wc_existing_product_id: 19624
[31-Oct-2019 17:34:55 UTC] [admin-ajax.php][][][DEBUG] get_post_thumbnail_id: no media attached to product ID = 19624
[31-Oct-2019 17:34:55 UTC] [admin-ajax.php][][][DEBUG] Updating existing product: Data: Array
[sku] => 113-4041
[name] => Power Pack 4 Cyl.
[slug] => 113-4041
[type] => simple
[description] => 1988-2001 (120,125,130,135 & 140HP) Loop Charged Engines w/ Quick Start & S.L.O.W., 6700 RPM Limit


113-4041, 18-5772, 583489, 584040, 584041, 9-25017
[upsell_ids] => Array
[0] => 19427

[images] => Array
        [0] => Array
                [src] =>
                [position] => 0


[categories] => Array
        [0] => Array
                [id] => 262



[31-Oct-2019 17:34:56 UTC] [admin-ajax.php][][] Error: Invalid image: Sorry, this file type is not permitted for security reasons. [woocommerce_product_image_upload_error]

There are over 900 product pages we are attempting to update. This error is returned for every product page image file. I have verified that the image files exist.

Up through WooCommerce version 3.5.1 I do not get this error. I see the error for versions 3.6.5, 3.7.0, 3.7.1. I have not tested versions between 3.5.1 and 3.6.5 to see in which version the error starts appearing. I am assuming the error exists in all versions since at least 3.6.5.

@issue-label-bot issue-label-bot bot added the type: bug label Nov 5, 2019

This comment has been minimized.

Copy link

@issue-label-bot issue-label-bot bot commented Nov 5, 2019

Issue-Label Bot is automatically applying the label type: bug to this issue, with a confidence of 0.85. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.