As of version 4.18.1, the WordPress File Upload plugin Professional enables Directory Uploads.
The user can select to upload entire folders, together with files, through the upload form of the plugin.
This feature can be activated by enabling option Directory Upload in the visual editor of the upload form, or by adding allowdir=”true” in the shortcode.
Note: Multiple Files Upload option must also be enabled so that directory uploads can work.
After the option is enabled, the user can add entire folders to the upload form, either by dragging them onto the form, or by selecting them with Select Files button.
Add Folders By Dragging
The user can select one or more folders and files on their computer and drag them onto the upload form.
The plugin will automatically extract all files from the selected folders and add them to the form. If the folders contain nested folders, their files will also be added.
Add Folders By Selection
The user can select folders by using the Select Files button of the upload form. When pressed, a dialog pops up prompting the user to select files or folders.
However, browsers do not allow to select files and folders from the same dialog. You can either select files, or folders, not both.
So, the plugin uses keyboard keys and gestures to determine when Select Files button is intended for files selection and when it is intended for folder selection.
The plugin uses a specific visual distinction to show to the user that the Select Files button is intended for folder selection. It shows a blue dot on the top-left corner of the Select Files button.
By default and without pressing any key, the Select Files button is intended for files selection. So, when it is pressed, the shown dialog will prompt the user to select files.
The user has three options to set the Select Files button for folder selection:
- To press and hold the Control key from the keyboard. While Control key is pressed, the blue dot shows up on the Select Files button, meaning that it is now intended for folder selection. When the button is pressed, the shown dialog will prompt the user to select a folder, not files.
- To press Alt and Control keys from the keyboard simultaneously. This combination activates folder selection permanently, until Alt + Control is pressed again.
- To tap with two or three fingers on the Select Files button from a touch screen. This gesture activates folder selection permanently, until the button is tapped again the same way.
Besides these options, the administrator has the option to force the Select Files button to always select folders, by activating option Force Only Directory Selection in the visual editor of the upload form, or by adding forcedir=”true” in the shortcode.
In this case, the user has not other options with keyboard keys or gestures.
It is noted that browsers allow only one folder to be selected with the select dialog every time. Furthermore, after the folder is selected, a message will popup prompting the user to confirm the selection:
After the user confirms the selection, the plugin will extract all files from the selected folder and add them to the form. If the folder contains nested folders, their files will also be added.
Here are some additional notes about the users’ options:
- The first two options, using keyboard keys, are intended for computers and laptops or in general devices with physical keyboards. They will not work with virtual keyboards.
- The second option, Alt + Control combination, was specifically designed for Mac OSX devices, because the first one, Control + button click, might not work.
- The third option, tapping, is intended for tablets and mobile phones that do not have a physical keyboard, but they have a touch screen. However, folder selection is not entirely supported by these devices, so even if folder selection is activated, the device will only allow files to be selected.
The blue dot on the Select Files button, when folder selection is activated, is drawn using the following CSS selectors:
Admins and web designers can customize the appearance of the Select Files button by using these selectors.
It is also noted that Directory Selection is not an official standard yet, although it is supported by all major browsers. If there are any changes to the specification, the plugin will incorporate them through a new release.
For additional information or technical support, do not hesitate to contact us.
The Iptanus Team