Opened 3 years ago
Last modified 20 months ago
#12350 reopened enhancement
Check folder permissions before uploading file
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Administration | Version: | |
| Severity: | normal | Keywords: | upload media permission |
| Cc: | kbcmdba |
Description
It would be nice if wordpress - or especially the media-upload module would check if its able or has the necessary file permissions to create the upload directory.
Change History (4)
- Milestone Unassigned deleted
- Resolution set to worksforme
- Status changed from new to closed
- Cc kbcmdba added
- Component changed from General to Administration
- Resolution worksforme deleted
- Status changed from closed to reopened
First, let me say - thanks for Wordpress - it's a fantastic tool for folks that don't need to care about HTML and just want to communicate.
I reopened this issue because I feel it describes what I'm seeing even though it was closed/worksforme by someone else.
When specifying the uploads folder as "/wp-content/uploads", WP doesn't gripe at me when there is no such folder on the file system (/wp-content/uploads, not ./wp-content/uploads). There is a folder in the WP tree with that name, but nothing with the absolute path of /wp-content/... If nothing else, I would expect WP to warn me (when configuring it as an admin) that the path I specified doesn't exist yet.
This report was made while using Wordpress 3.2.1 on CentOS 5.6. Wordpress was installed into the virtualhost root directory (not http://f.q.d.n/wordpress).
comment:3
SergeyBiryukov — 20 months ago
- Milestone set to Awaiting Review
Well in response to the /wp-content versus ./wp-content. I believe wordpress if it were to validate it would validate the path off of ABSPATH, so /wp-content/uploads would work.
This code was able to fix it on line 150 of wp-admin/options.php:
if ( $option == 'upload_path' && !file_exists(ABSPATH . $value) ) {
add_settings_error('general', 'path-does-not-exist', __('Media Uploads Folder does not exist.'), 'error');
} elseif ( $option == 'upload_path' && !is_readable(ABSPATH . $value) ) {
add_settings_error('general', 'path-not-readable', __('Media Uploads Folder is not readable.'), 'error');
}

It does.