Simple Plugin Which Lets Users Upload Files Into Your Dropbox Folder

Today we will write a plugin which allows your users to send their files to you, to your Dropbox account. It might be needed for several purposes; For example, if you provide a contest for your readers, they might need to send you some files that you want partitioned off on a unique folder location in Dropbox. In short, this plugin is for receiving files, which must not be made public yet, which must be reviewed by you.


Before We Start

You can download ready plugin via Download Source button. Now we are going to describe our plugin step by step. We will use Jaka Jancar's Dropbox Uploader class(under MIT license) for creating our plugin.

We will build this plugin using our own hypothetical situation from the intro paragraph: Assume that you are hosting a competition for the "Best Desktop Screenshot" around your users. Every registered site user may send his/her desktop screenshot to you. After a deadline, you will look all and then you will publish the winners. So let's begin to build our plugin!


Step 1 Creating First File

Create a folder called dbuploader in wp-content/plugins diretory. Create a new PHP file called DropboxUploader.php inside it; Open it in your text editor and paste&save this code:


Step 2 Building The Plugin File

Create main plugin file called dbuploader.php in the same directory; Open it inside your editor and paste&save this code there:


Step 3 Finishing The Plugin:

Create config.php file in your plugin folder, then paste this code there:

Then edit this code: set your email, password, dropbox folder, file size limit, supported file types and then save it.


Some Suggestions:

Suggestion 1:

If you want to make it available for all users, not only for logged in users, then you can edit the code, remove this...

...condition from the plugin. Instead of it, you can integrate Recaptcha with your plugin.

Suggestion 2:

You can also format uploaded files' name. Just edit this line:

That's all, good luck!

Tags:

Comments

Related Articles