After 4.6.0 version, WordPress File Upload plugin supports Google Drive uploads. Administrators can choose to transfer the files uploaded by their website visitors to a Google Drive account.
To enable Google Drive uploads, we first need to define a Google Drive account and allow the plugin to have access to it. We do this very easily by going to the plugin’s Settings in Dashboard:
There is a Google Drive Uploads option there which shows that Google Drive Uploads are not activated and prompts to press the “Press here” button. By pressing this button, a new page (or tab) appears first asking to select a Google account and then informing that “WordPress File Upload Plugin wants to access your Google Account” as shown below:
Press the Allow button to go to the next screen, which displays a code:
Copy the code and paste it into the textbox of the Google Drive Uploads option in plugin’s Settings as follows:
After pressing the Finish button, approval process will complete and you will see the “Activated” text, as shown below:
Now you are ready to enable Google Drive uploads to your WordPress File Upload plugin instances, by adding manually the attribute gdrive=”true” inside the plugin’s shortcode. If you wish to use the Shortcode Composer, then go to Interoperability tab and enable the option “Upload to Google Drive”, as shown below:
Another 4 Google Drive options are provided:
- The ability to define the destination directory at the Google Drive account by setting gdrivepath attribute into the shortcode, or by setting Google Drive Path option using the Shortcode Composer. If this directory does not exist, it will be created when a file is transferred to the Google Drive account. If no destination path is set, files will be transferred to the root of Google Drive account.
- The ability to add the submitted userdata, if the upload form contain userdata, to the Google Drive file by setting gdriveuserdata attribute into the shortcode, or by setting Include Userdata option using the Shortcode Composer. Google Drive allows to add a description for each file, so the submitted userdata are added in file’s description, as shown below:
- The ability to determine if the local file will be deleted or not, by setting the value “delete” or “keep” in gdrivelocal attribute into the shortcode, or by setting Local File Action option using the Shortcode Composer.
- The ability to trash any files in Google Drive destination folder having the same filename as the uploaded file, by setting gdriveduplicates attribute into the shortcode, or by setting Trash Duplicates option using the Shortcode Composer. It is noted that Google Drive allows files and subfolders with identical names to exist in the same folder, so this attribute ensures that only one file with the same name exists, overwriting any previous files.
After enabling Google Drive uploads, files that uploaded through the WordPress File Upload plugin will be transferred to the Google Drive account that we have set.
For any questions, problems or suggestions, please contact us.
The Iptanus team