DooFiles
Cloudflare R2
Connect your Cloudflare R2 buckets to DooFiles: create the API token, add buckets, check them, and upload, move, copy, preview and restore their files from the file manager.
Overview
DooFiles can open your Cloudflare R2 buckets in the file manager, next to the files of your site. Once you connect your R2 account and add a bucket, a Cloudflare R2 folder appears in the tree, below the folder of your site, with each bucket inside. You browse, upload, rename, move, delete and preview the files of a bucket as you do with the files of your site, and you can drag files between your site and a bucket to copy them.
Your buckets stay private. DooFiles does not make anything public, and it keeps the keys of your R2 account encrypted on your site.
Cloudflare R2 arrived in DooFiles 1.1.0. Amazon S3 is coming soon.
[SCREENSHOT_HERE: DooFiles › File manager with the Cloudflare R2 folder open in the tree, two buckets inside, and the files of one bucket in the list]
What you need
- A Cloudflare account with R2 turned on, and at least one bucket.
- An R2 API token with the Object Read & Write permission, limited to the buckets you want in DooFiles. A token with only Object Read also works, but then you can only browse and download.
- The Account ID of your Cloudflare account.
- An active DooFiles license. Without one, the Storage tab is locked, and buckets cannot be opened, not even to browse.
- The PHP OpenSSL and SimpleXML extensions on your server. Most servers have both. If one is missing, the Cloudflare R2 card says so.
Create the API token
In your Cloudflare dashboard:
- Open R2 Object Storage. Your Account ID is shown on this page. Copy it.
- Open the page to manage the R2 API tokens (Manage API tokens), and create a new token.
- Choose the Object Read & Write permission.
- Limit the token to the buckets you will add to DooFiles, instead of all the buckets of your account.
- Create the token, and copy the Access Key ID and the Secret Access Key.
Cloudflare shows the Secret Access Key only once. Paste it in DooFiles before you close that page, or create a new token.
A token limited to a few buckets is safer: if it ever leaks, it can only reach those buckets. You can create one token for each site.
Connect your account
- Go to DooFiles › Storage and open the Cloudflare R2 card.
- Paste the Account ID, the Access Key ID and the Secret Access Key.
- Click Save keys, and confirm your password.
The card shows Keys saved. and, from then on, only the Account ID and the last four characters of the Access Key ID. DooFiles never shows the secret again, not even to you.
[SCREENSHOT_HERE: DooFiles › Storage, the Cloudflare R2 card with the Account ID, the Access Key ID ending in four characters, and the list of buckets]
Add a bucket
- In the Cloudflare R2 card, click Add bucket, at the bottom. When the card has no buckets, the form is already open.
- Type the name of the bucket, as it appears in Cloudflare.
- Optional: in Folder in the bucket, type a folder, such as
site-files. DooFiles then uses only that folder of the bucket. Leave it empty to use the whole bucket. - Leave Jurisdiction on Automatic (the account), unless you created the bucket in a jurisdiction: then choose European Union or FedRAMP.
- Click Add bucket, and confirm your password.
DooFiles checks the bucket before adding it. If the token cannot open it, the bucket is not added and the card tells you why. You can add up to 20 buckets with the same keys. Cancel closes the form.
Check a bucket
Each bucket in the card shows a drive icon whose color says how its last check went:
| Color | What it means |
|---|---|
| Green | Connected. DooFiles can read and write in the bucket |
| Amber | Read only. The token can read the bucket but not change it |
| Red, with a small shake | Not answering. The reason appears under the bucket |
The color comes from the last check: DooFiles does not check your buckets on its own. Click Test connection to check a bucket again. The bucket dims while DooFiles checks it, and DooFiles shows The bucket answered. when it works. You can keep typing in the Add bucket form meanwhile.
When a bucket does not answer, the card shows Not answering at the top and opens on its own the next time you visit the tab.
Change the keys, remove a bucket or disconnect
- Edit keys opens the form with the keys. Paste the new Access Key ID and Secret Access Key, or leave both empty to keep the saved ones, and click Save keys. DooFiles checks every bucket with the new keys, and keeps the old ones if no bucket accepts them.
- Remove, next to a bucket, takes it out of DooFiles. The bucket and its files stay as they are in Cloudflare.
- Disconnect, at the bottom of the card, makes DooFiles forget the keys and every bucket. Nothing changes in Cloudflare.
Saving the keys, adding or removing a bucket and disconnecting always ask for your password, and for your second factor if you use one, even when code changes do not. See Password confirmation.
Use your buckets in the file manager
In DooFiles › File manager, open Cloudflare R2 in the tree, below the folder of your site, and click a bucket. You can also fold the folder of your site to keep the tree short: DooFiles remembers it.
Inside a bucket you can:
- Open folders in the tree, in the list and in the breadcrumbs.
- Upload files and whole folders, with Upload files or by dragging them from your computer. See Upload files.
- Create folders, with New folder in the folder panel or by right-clicking an empty part of the list.
- Rename a file or a folder, with F2 or the right-click menu.
- Move files and folders by dragging them, also to another bucket. Both buckets must allow writing.
- Delete: what you delete goes to the DooFiles Trash. See The Trash.
- Download a file.
- Preview images, videos, audio files and PDF files in the media viewer. SVG images and other files are downloaded instead.
- See thumbnails of images up to 20 MB in the list, when thumbnails are on. DooFiles downloads each image once to make its thumbnail.
Renaming or moving copies each file to its new place and then deletes the original, because R2 cannot rename files. With large files or many files, this takes a moment.
A folder shows up to 5,000 items. In a folder with more, DooFiles shows the first 5,000 and tells you: This folder is very large; only part of it is shown.
Upload files
Files go up through your site, as all your uploads do: in parts for large files, with the uploads panel, pause and resume. The largest upload set in DooFiles › Files applies too. See Uploads.
- While a large file goes up, your server needs a bit more free space than the size of the file.
- Uploading a code file, such as a PHP file, asks for your password, as on your site.
- Replacing a file in a bucket moves the old one to the Trash first, because R2 keeps no versions. To get it back, rename or move the new file and restore the old one from the Trash.
Copy between your site and a bucket
Drag files or folders from your site onto a bucket or one of its folders in the tree, or from a bucket onto a folder of your site in the tree. Between your site and a bucket, DooFiles copies: the original stays where it was. Inside your site or inside R2, dragging moves, as always.
- Up to 500 files at a time. With more, DooFiles tells you: This is more than 500 files. Copy it in smaller parts.
- DooFiles never replaces a file that already exists in the destination. It lists it and copies the rest.
- Copying into your site follows the largest upload set in DooFiles › Files and needs free space on your server for all of it.
- A folder of your site with a private folder inside is not copied to R2: A private folder cannot be copied from outside. Open it and copy what is inside.
- Copying code into your site, such as PHP files, asks for your password. Copying into the folders of WordPress shows the same warning as any other change there. See Manage files.
Large folders
Moving, renaming, deleting or restoring a large folder of a bucket can take a while, because each file is copied and deleted. DooFiles does it in rounds, and a notice stays on screen with the count:
Working on a large folder in Cloudflare R2: 1,200 files moved so far…
When it finishes, DooFiles shows The large folder is ready. If Cloudflare R2 asks to slow down or does not answer, DooFiles waits and tries again, up to four times.
Keep the page open until the notice says the folder is ready. If you close it before, the folder is left half done, with part of its files in each place, and DooFiles tells you next time: This task is no longer running. Refresh the folder to see how it was left. Refresh the folder and repeat the action for what is left.
When you were deleting or restoring the folder, nothing is lost: what reached the Trash shows there about ten minutes later, and Restore puts it back into the folder that stayed in place.
The Trash
What you delete from a bucket goes to the DooFiles Trash, with a cloud next to its original location, and stays there the same days as the rest. Restore puts it back in the same place of the same bucket. Delete permanently and Empty trash erase it from the bucket.
- Deleted items stay inside the same bucket, in a hidden folder of DooFiles named
.doofiles, so they still count in your R2 storage until the Trash lets them go. - If something with the same name now exists in the original place, DooFiles does not restore the item: Something with that name already exists here. Rename or move the other one first.
- If you remove a bucket from DooFiles, its items leave the Trash. Add the bucket again to see them.
What is not available in a bucket yet
- Search.
- New files, and editing text or code.
- Previous versions of files.
- Private folders.
- Compressing into a zip file, and extracting one. To download a whole folder, copy it to your site and compress it there.
- Editing images in the viewer, and previewing SVG images.
- Thumbnails of videos and audio files, the details of photos and videos, and the cover and tags of audio files.
Inside a bucket, DooFiles hides these actions. If one is still reached, for example from an old link, it says: This cannot be done in Cloudflare R2 yet.
Read-only mode
With read-only mode on, you can browse your buckets, preview and download their files, and check them, but nothing changes: no uploads, folders, renames, moves, deletes or copies.
Activity
Every action in a bucket appears in the Activity log, as on your site: Uploaded, Downloaded, Previewed, Renamed, Moved, Moved to trash and the others. The connection adds its own entries:
- Saved the Cloudflare R2 keys, without the keys;
- Added a Cloudflare R2 bucket and Removed a Cloudflare R2 bucket;
- Cloudflare R2 bucket check, when a check fails;
- Disconnected Cloudflare R2;
- Copied between the site and Cloudflare R2, with how many files were copied.
Attempts that did not work show the Failed label.
How DooFiles protects your buckets
- Encrypted keys. The keys are saved encrypted on your site. The settings page never receives the secret, and the Activity log never records it.
- Your password first. Changing the connection always asks for your password, and for your second factor if you use one.
- Links that expire. A download or a preview opens straight from Cloudflare, with a link that stops working after 5 minutes. Your buckets stay private.
- Nothing runs in your browser. SVG images, HTML pages and other files that could run code are always downloaded, never opened.
- Only the buckets you add. DooFiles opens only the buckets on your list, and only their folder if you set one.
Troubleshooting
| Problem | What to do |
|---|---|
| The Account ID has 32 letters and numbers. You find it on the R2 page of your Cloudflare dashboard. | Copy the Account ID again from R2 Object Storage in Cloudflare. It is not your email or the name of your account |
| Paste the Access Key ID and the Secret Access Key of your R2 API token. | Paste both keys of the R2 API token. The Access Key ID has 32 characters and the Secret Access Key has 64. A Cloudflare API token of another kind does not work |
| Cloudflare R2 did not accept the keys. Check the Access Key ID and the Secret Access Key. | The keys are wrong, or the token was deleted. Create a new token and click Edit keys |
| The R2 API token does not have permission for this. Check its permissions and the buckets it can use. | Give the token the Object Read & Write permission and add the bucket to the buckets it can use |
| This bucket does not exist in this Cloudflare account, or it is in another jurisdiction. | Check the name of the bucket, and choose its Jurisdiction if you created it in one |
| Bucket names use lowercase letters, numbers and hyphens, from 3 to 63 characters. | Type the name exactly as it appears in Cloudflare |
| DooFiles can use up to 20 buckets. | Remove a bucket you no longer use |
| A bucket shows the amber icon, or The R2 API token can only read. Give it the Object Read & Write permission to change files in the bucket. | The token can only read that bucket. Change its permission in Cloudflare, then click Test connection |
| Cloudflare R2 did not answer. Try again in a moment. or Cloudflare R2 asked to slow down. Try again in a moment. | Wait a moment and try again. If it keeps happening, check that your server can reach the internet |
| This server cannot connect to Cloudflare R2: it needs the PHP OpenSSL and SimpleXML extensions. | Ask your hosting provider to turn on both PHP extensions |
| The keys of Cloudflare R2 could not be read. Save them again in DooFiles › Storage. | Click Edit keys and paste the keys again |
| Cloudflare R2 does not appear in the tree | Add at least one bucket in DooFiles › Storage, and check that your license is active |
| There is no search box inside a bucket | Search is not available in buckets yet |
| Between the site and Cloudflare R2 files are copied, not moved. | Drag the files to copy them. Delete the originals afterwards if you no longer need them |
| There is not enough free space on the server for this file. | A large upload waits on your server while it goes to the bucket. Free some space, or upload the file directly in Cloudflare |
| This folder is reserved for DooFiles. | The name .doofiles is kept for the Trash of DooFiles. Choose another name |
| This name is not valid in Cloudflare R2. or This name is too long for Cloudflare R2. | Choose a shorter name, without the characters that names cannot have. See Manage files |
| This file is no longer in the bucket. | Someone deleted or moved it outside DooFiles. Click the name of the folder in the breadcrumbs to refresh it |
Need more help? Open a support ticket.
For developers
Moving, deleting and restoring large folders of a bucket runs in rounds of 15 seconds. If your server cuts requests sooner, ask for shorter rounds with the doofiles_r2_step_seconds filter:
add_filter( 'doofiles_r2_step_seconds', function () {
return 8;
} );