Categories
Technisches

WordPress Media Upload broken

An Update to WordPress core broke media upload on all my sites. The update was on 2019-10-14, but problems arised now, when november begun.

Setup

We use a special directory structure which is like this:

  • wp/
  • uploads/
  • wp-content/
  • index.html
  • wp-config.php

With this layout it’s possible for us to have the different parts in different places: wp is a clean, unmodified WordPress checkout, uploads contains all the media files and wp-content contains the code for the website.

With setting constants WP_SITEURL, WP_CONTENT_DIR, WP_CONTENT_URL, WP_PLUGIN_DIR and WP_PLUGIN_URL along with UPLOADs this worked fine. However:

define(‚UPLOADS‘,‘../uploads‘);

was needed, because _wp_upload_dir() calculates the uploads-directory by appending UPLOADS to ABSURL – and ABSURL is in my wp-folder.

Problem

Recent Changes in WordPress Core forbid creating directories with „../“ in their path. Uploading files works, but creation of the „2019/11/“-folder fails.

https://core.trac.wordpress.org/ticket/48316

https://foliovision.com/2019/11/wordpress-unable-to-create-directory

https://wordpress.stackexchange.com/questions/352042/install-wordpress-with-custom-directory-layout-without-breakting-media-upload