Touch File Creator
A simple and secure utility plugin for WordPress administrators to create new, empty files directly from the dashboard.
by Nathan Johnson · github.com/nathandozen3/touch-file-creator · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/nathandozen3/touch-file-creator/archive/refs/heads/main.zipReadme
Touch File Creator
A simple and secure utility plugin for WordPress administrators to create new, empty files directly from the dashboard.
Description
The Touch File Creator plugin provides a simple interface in the WordPress admin area to create new, empty files at a specified location within your site's directory. This is particularly useful for developers or site administrators who need to quickly create a placeholder file without using an FTP client or cPanel file manager.
The plugin automatically handles the creation of parent directories if they don't already exist, making the process seamless.
Key Features:
- Simple Interface: A single input field to enter the desired file path.
- Security First: Includes robust checks to prevent directory traversal and ensures files are only created in writable directories.
- Automatic Folder Creation: Automatically creates parent folders in the path if they are missing.
- Lightweight: The plugin is a single file with minimal code.
Installation
- Download: Download the plugin files.
- Upload:
- Unzip the
touch-file-creator.zipfile. - Upload the entire
touch-file-creatorfolder to the/wp-content/plugins/directory.
- Unzip the
- Activate: Navigate to the Plugins screen in your WordPress dashboard and activate "Touch File Creator."
How to Use
- After activating the plugin, a new menu item called "File Creator" will appear in your dashboard's left-hand navigation.
- Click on "File Creator" to access the tool.
- In the input field, enter the relative path and file name you wish to create. The path should be relative to your WordPress root directory.
- Example: To create a new file named
style.cssin your theme's folder, you might enter:wp-content/themes/your-theme/style.css. - Example: To create a file inside a new folder within your uploads directory, you might enter:
wp-content/uploads/custom-assets/logo.svg.
- Example: To create a new file named
- Click "Create File".
The plugin will display a success message confirming the file's creation or an error message if the operation failed.
Security
⚠️ Warning: This is a powerful administrative tool. It is strongly recommended that you use this plugin only when necessary and deactivate it when you are finished. Never leave it active on a live site for an extended period, as any tool that can write to the file system presents a potential security risk if your site is compromised.
The plugin includes the following security measures:
- Capability Check: Only users with
manage_options(administrators) can access the tool. - Nonce Protection: Prevents Cross-Site Request Forgery (CSRF) attacks.
- Path Validation: Blocks attempts at directory traversal (
../).
Changelog
1.0.1
- Enhancement: Added a check to automatically create parent directories if they don't exist, using
mkdir()with therecursiveparameter. - Bug Fix: Addressed user confusion regarding the inability to create files in non-existent folders.
1.0.0
- Initial release.
- Functionality to create an empty file in an existing, writable directory.