最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

images - Can't access 'Store uploads in this folder'

programmeradmin1浏览0评论

I have had a problem uploading images from my laptop onto wordpress. Basically, the images are broken and cannot be viewed when implemented on the site.

After trying to rectify the problem through filezilla, I have tracked the solution down to this video:

However, I am unable to access the "store uploads in this folder" section within Media > Settings. Exactly the same problem as this forum post:Why "Store uploads in this folder" option is not showing in Media Settings in WordPress

I want to know how to access this part of wordpress to try and resolve my issue. Is this possible?

Thanks, Andrew

p.s. I am new to wordpress and i can't understand the answer to the question given on this post.

I have had a problem uploading images from my laptop onto wordpress. Basically, the images are broken and cannot be viewed when implemented on the site.

After trying to rectify the problem through filezilla, I have tracked the solution down to this video: https://www.youtube/watch?v=9Gb323tmRj0

However, I am unable to access the "store uploads in this folder" section within Media > Settings. Exactly the same problem as this forum post:Why "Store uploads in this folder" option is not showing in Media Settings in WordPress

I want to know how to access this part of wordpress to try and resolve my issue. Is this possible?

Thanks, Andrew

p.s. I am new to wordpress and i can't understand the answer to the question given on this post.

Share Improve this question asked May 6, 2019 at 15:43 Andrew WallaceAndrew Wallace 211 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 1

This is a very good question.

The answer to the referenced post requires a change to the WP options. They are stored in the database in the wp_options table (assuming wp_ is your prefix).

There are a few ways to change these in this case:

  • Direct DB access: if you're comfortable modifying the WP DB directly (and you have access) you can add a record to the table. Many (or all) of the tables in the WP database should be prefixed the same, wp_ by default, although that default is often changed. That is your table prefix. Find the table that looks like {prefix}options (like wp_options if your prefix is wp_) and add a record to it. If you're using phpMyAdmin or a similar tool, you'll only need to know the key and value to enter. Use the key upload_path and put in some non-empty value. This should make both fields show up in the admin UI. You can do the same with a SQL insert statement.
  • WP CLI: this is the method mentioned in the answer to your referenced post. If you've not used the CLI (command line interface) before, it's essentially a script shell for changing WP things. This wraps the DB access for you in this case. Setting it up usually isn't difficult, see here for how.
  • A Plugin: I haven't seen a particular plugin for changing WP options but I would assume that there are probably several. You could add this to an existing plugin on the site by adding the line update_option('upload_path', '/path/to/uploads');. That code could go anywhere, including in a theme. Once run, you should remove it (or you'll never be able to change this value to any other option).

Warnings: you are changing a WP option. While the effects of this option are limited to uploading (and related), there are things in the option table that, if modified incorrectly, will completely torch your site. If you're in a development environment that you can restore fairly easily, hack away. Be very careful doing this on a production site, with care including full verified backups before changing anything. Things like this are always best tested in a non-production environment first.

Either way, you will need to know the full canonical path to your upload folder and you'll need it to be set with appropriate permissions. Exactly what those are depend on your system. There are plenty of docs on the Internet which explain how to figure out those details correctly.

Also bear in mind that (at least according to the referenced answer) this option is set to be deprecated in some future WP version. I haven't checked that so I don't know if it's true in > 4.9.8 but it appears that the option header is still there on my 5.1.1 installation (once again, not tested). I also don't know what these options will be replaced with once they are removed. One would assume that the ability to upload to a non-default location wouldn't be removed, although how uploads work may change or the admin UI for this part of the WP world may be overhauled, either for some number of reasons.

Please ask if you need more detail on a specific part of this or if something is unclear.

发布评论

评论列表(0)

  1. 暂无评论