简体   繁体   中英

WP on GAE Insert Image in Post: “An error occurred in the upload. Please try again later.”

I've been banging my head against a wall on this one. I'm running Wordpress on AppEngine and have everything working fine ( followed the GAE install instructions ) except I can't insert an image into a post. I've installed the GAE WP plugin and have the cloud storage set up properly (which I know because the upload actually works and I can see the uploads when I go to Media > Library in the left nav in WP.

Here's the error's I have in the logs for wp-admin/async-upload.php:

W 2013-09-28 12:05:02.529
PHP Notice:  Undefined variable: types in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385
W 2013-09-28 12:05:02.529
PHP Warning:  array_keys() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385
W 2013-09-28 12:05:02.529
PHP Warning:  asort() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2231
W 2013-09-28 12:05:02.529
PHP Warning:  Invalid argument supplied for foreach() in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2232
W 2013-09-28 12:05:02.529
PHP Notice:  Undefined variable: icon in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4398

And here's what I've got in the logs for wp-admin/admin-ajax.php:

W 2013-09-28 12:05:03.683
PHP Notice:  Undefined variable: types in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385
W 2013-09-28 12:05:03.683
PHP Warning:  array_keys() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385
W 2013-09-28 12:05:03.683
PHP Warning:  asort() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2231
W 2013-09-28 12:05:03.683
PHP Warning:  Invalid argument supplied for foreach() in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2232
W 2013-09-28 12:05:03.683
PHP Notice:  Undefined variable: icon in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4398
W 2013-09-28 12:05:03.745
PHP Notice:  Undefined variable: types in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385
W 2013-09-28 12:05:03.745
PHP Warning:  array_keys() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385
W 2013-09-28 12:05:03.745
PHP Warning:  asort() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2231
W 2013-09-28 12:05:03.745
PHP Warning:  Invalid argument supplied for foreach() in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2232
W 2013-09-28 12:05:03.745
PHP Notice:  Undefined variable: icon in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4398
W 2013-09-28 12:05:03.751
PHP Notice:  Undefined variable: types in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385
W 2013-09-28 12:05:03.751
PHP Warning:  array_keys() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385
W 2013-09-28 12:05:03.751
PHP Warning:  asort() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2231
W 2013-09-28 12:05:03.751
PHP Warning:  Invalid argument supplied for foreach() in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2232
W 2013-09-28 12:05:03.751
PHP Notice:  Undefined variable: icon in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4398
W 2013-09-28 12:05:03.755
PHP Notice:  Undefined variable: types in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385
W 2013-09-28 12:05:03.755
PHP Warning:  array_keys() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385
W 2013-09-28 12:05:03.756
PHP Warning:  asort() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2231
W 2013-09-28 12:05:03.756
PHP Warning:  Invalid argument supplied for foreach() in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2232
W 2013-09-28 12:05:03.756
PHP Notice:  Undefined variable: icon in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4398

What am I missing here? Thanks for any help.

This isn't the optimal solution, but as a temporary workaround I've been able to solve the problem by suppressing errors in /includes/post.php. Basically the AJAX call was getting a bunch of errors with the data and didn't know what to do with it so I just stuck error_reporting(0); at the top of the file.

You could also get rid of the messages by adding "application_readable: true" to the following mapping in your app.yaml

- url: /(.*\.(ico|jpg|png|gif))$
  static_files: wordpress/\1
  upload: wordpress/.*\.(ico|jpg|png|gif)$

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM