Get $500+ of the best After Effects files, video templates and music for only $20!
Simple Plugin Which Lets Users Upload Files Into Your Dropbox Folder

Simple Plugin Which Lets Users Upload Files Into Your Dropbox Folder

Tutorial Details
  • Program: WordPress
  • Version: 3.0+
  • Difficulty: Intermediate
  • Estimated Completion Time: 30 minutes

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:

<?php
/**
 * Dropbox Uploader
 *
 * Copyright (c) 2009 Jaka Jancar
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * @author Jaka Jancar [jaka@kubje.org] [http://jaka.kubje.org/]
 * @version 1.1.5
 */
class DropboxUploader {
    protected $email;
    protected $password;
    protected $caCertSourceType = self::CACERT_SOURCE_SYSTEM;
    const CACERT_SOURCE_SYSTEM = 0;
    const CACERT_SOURCE_FILE = 1;
    const CACERT_SOURCE_DIR = 2;
    protected $caCertSource;
    protected $loggedIn = false;
    protected $cookies = array();

    /**
     * Constructor
     *
     * @param string $email
     * @param string|null $password
     */
    public function __construct($email, $password) {
        // Check requirements
        if (!extension_loaded('curl'))
            throw new Exception('DropboxUploader requires the cURL extension.');

        $this->email = $email;
        $this->password = $password;
    }

    public function setCaCertificateFile($file)
    {
        $this->caCertSourceType = self::CACERT_SOURCE_FILE;
        $this->caCertSource = $file;
    }

    public function setCaCertificateDir($dir)
    {
        $this->caCertSourceType = self::CACERT_SOURCE_DIR;
        $this->caCertSource = $dir;
    }

    public function upload($filename, $remoteDir='/') {
        if (!file_exists($filename) or !is_file($filename) or !is_readable($filename))
            throw new Exception("File '$filename' does not exist or is not readable.");

        if (!is_string($remoteDir))
            throw new Exception("Remote directory must be a string, is ".gettype($remoteDir)." instead.");

        if (!$this->loggedIn)
            $this->login();

        $data = $this->request('https://www.dropbox.com/home');
        $token = $this->extractToken($data, 'https://dl-web.dropbox.com/upload');

        $data = $this->request('https://dl-web.dropbox.com/upload', true, array('plain'=>'yes', 'file'=>'@'.$filename, 'dest'=>$remoteDir, 't'=>$token));
        if (strpos($data, 'HTTP/1.1 302 FOUND') === false)
            throw new Exception('Upload failed!');
    }

    protected function login() {
        $data = $this->request('https://www.dropbox.com/login');
        $token = $this->extractToken($data, '/login');

        $data = $this->request('https://www.dropbox.com/login', true, array('login_email'=>$this->email, 'login_password'=>$this->password, 't'=>$token));

        if (stripos($data, 'location: /home') === false)
            throw new Exception('Login unsuccessful.');

        $this->loggedIn = true;
    }

    protected function request($url, $post=false, $postData=array()) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
        switch ($this->caCertSourceType) {
            case self::CACERT_SOURCE_FILE:
                curl_setopt($ch, CURLOPT_CAINFO, $this->caCertSource);
                break;
            case self::CACERT_SOURCE_DIR:
                curl_setopt($ch, CURLOPT_CAPATH, $this->caCertSource);
                break;
        }
        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        if ($post) {
            curl_setopt($ch, CURLOPT_POST, $post);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
        }

        // Send cookies
        $rawCookies = array();
        foreach ($this->cookies as $k=>$v)
            $rawCookies[] = "$k=$v";
        $rawCookies = implode(';', $rawCookies);
        curl_setopt($ch, CURLOPT_COOKIE, $rawCookies);

        $data = curl_exec($ch);

        if ($data === false)
            throw new Exception('Cannot execute request: '.curl_error($ch));

        // Store received cookies
        preg_match_all('/Set-Cookie: ([^=]+)=(.*?);/i', $data, $matches, PREG_SET_ORDER);
        foreach ($matches as $match)
            $this->cookies[$match[1]] = $match[2];

        curl_close($ch);

        return $data;
    }

    protected function extractToken($html, $formAction) {
        if (!preg_match('/<form [^>]*'.preg_quote($formAction, '/').'[^>]*>.*?(<input [^>]*name="t" [^>]*value="(.*?)"[^>]*>).*?<\/form>/is', $html, $matches) || !isset($matches[2]))
            throw new Exception("Cannot extract token! (form action=$formAction)");
        return $matches[2];
    }
}

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:

<?php
/*
Plugin Name: DboUploader - Dropbox upload
Plugin URI: http://www.webania.net/dbouploader/
Description: Upload to Dropbox
Version: 1.0
Author: Elvin Haci
Author URI: http://www.webania.net
License: GPL2
*/
/*  Copyright 2011,  Elvin Haci  (email : elvinhaci@hotmail.com)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License, version 2, as
    published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

function dbouploader($content = '') {

  if (is_user_logged_in())  add_shortcode('dbouploader', 'shortcoder');
  else add_shortcode('dbouploader', 'notloggedin');
	return $content;
}

function notloggedin($atts,$content = '') {
return 'You must be logged in!';
}

function shortcoder($atts,$content = '') {

 //////////////////
define("dboconf","1");
include(WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__))."/config.php");

if ($_POST) {

include(WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__))."/DropboxUploader.php");

    try {
        // Rename uploaded file to reflect original name
        if ($_FILES['file']['error'] !== UPLOAD_ERR_OK)
            throw new Exception('File was not successfully uploaded from your computer.');

    if(  !in_array($_FILES["file"]["type"],$supported_types) or $_FILES["file"]["size"] > $size_limit)
   throw new Exception('File size is too large or file type is not supported.');

        $tmpDir = uniqid('/tmp/DropboxUploader-');
        if (!mkdir($tmpDir))
            throw new Exception('Cannot create temporary directory!');

        if ($_FILES['file']['name'] === "")
            throw new Exception('File name not supplied by the browser.');
      global $current_user;
      get_currentuserinfo();

        $tmpFile = $tmpDir.'/'.str_replace("/\0", '_', $current_user->user_email.'_'.$_FILES['file']['name']);
        if (!move_uploaded_file($_FILES['file']['tmp_name'], $tmpFile))
            throw new Exception('Cannot rename uploaded file!');

        // Enter your Dropbox account credentials here
		$uploader = new DropboxUploader($dropbox_email, $dropbox_password);
        $uploader->upload($tmpFile, $_POST['dest']);

        return '<span style="color: green;font-weight:bold;margin-left:0px;">File successfully uploaded. Thank you!</span>';
    } catch(Exception $e) {
        return '<span style="color: red;font-weight:bold;margin-left:0px;">Error: ' . htmlspecialchars($e->getMessage()) . '</span>';
    }

    // Clean up
    if (isset($tmpFile) && file_exists($tmpFile))
        unlink($tmpFile);

    if (isset($tmpDir) && file_exists($tmpDir))
        rmdir($tmpDir);

}
else {
return '
<div class="box" align="center">
		<h1>Dropbox Uploader Demo<br>
		</h1>
		<form method="POST" enctype="multipart/form-data">
		<input type="file" name="file" /><br><br>
		<input type="submit" value="Upload your file!" />
		<input style="display:none" type="text" name="dest" value="'.$dropbox_folder.'" />
</div>	';
}
  ////////////////
 }

add_action('the_content', 'dbouploader');
?>

Step 3 Finishing The Plugin:

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

<?php
if(!defined('dboconf')){die();}
$dropbox_email=''; // YOUR DROPBOX EMAIL
$dropbox_password=''; // YOUR DROPBOX PASSWORD
$dropbox_folder='shared';
$supported_types=array('image/png','image/jpeg');
$size_limit='512000';
?>

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…

if (is_user_logged_in())  add_shortcode('dbouploader', 'shortcoder');

…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:

 $tmpFile = $tmpDir.'/'.str_replace("/\0", '_', $current_user->user_email.'_'.$_FILES['file']['name']);

That’s all, good luck!

Add Comment

Discussion 67 Comments

  1. Ravan Baghirov says:

    Well done! Very useful plugin!

  2. Vadim says:

    Nice! Thanks for this one it will be very useful I got some plans for it..

  3. Eli McMakin says:

    Holy cow. I can definitely see use for something like this. I’m gonna give it a shot.

  4. Eli McMakin says:

    I receive an error on my localhost:

    Warning: mkdir() [function.mkdir]: No such file or directory in C:\xampp\htdocs\wordPressSandbox\site\wordpress\sandbox\plugins\dbuploader\dbuploader.php on line 59

    Could this be due to problems with slashes? Does anyone else get this?

    • Elvin says:

      Hi Eli. I have tested this plugin in different web servers, it must work fine.
      Your given path seems to me strange. May be that is the reason? Generally WP plugins are situated in wp-content/plugins/ folder.

  5. Nice. Thanks for sharing. I love the max file size details!

  6. Eli McMakin says:

    @Elvin,

    I change my wp-content directory name for security reasons. However, I changed it at your suggestion.

    Received the same error:

    Warning: mkdir() [function.mkdir]: No such file or directory in C:\xampp\htdocs\wordPressSandbox\site\wordpress\wp-content\plugins\dbuploader\dbuploader.php on line 59
    Test:

    Error: Cannot create temporary directory!

    Could it be due to the differences between forward and backward slashes? I’m testing out the plugin on my localhost.

    • Elvin says:
      Author

      Hey Eli. No, i think that it is only permission error. İt tries to create temporary folder, but your web server folder permission doesn’t let it to perform this $tmpDir = uniqid(‘/tmp/DropboxUploader-’); Try to change temporary folder path, then it should work.

      • Andrew Heyd says:

        Hi Elvin,

        Thanks for the app. I ran into the same problem as Eli (see below), which you addressed on January 23rd with this response

        Hey Eli. No, i think that it is only permission error. İt tries to create temporary folder, but your web server folder permission doesn’t let it to perform this $tmpDir = uniqid(‘/tmp/DropboxUploader-’); Try to change temporary folder path, then it should work.

        I don’t understand what you mean by the your last sentence. Can you help me out? Thanks, Andrew

        ************* here is my error report:*************

        Warning: mkdir() [function.mkdir]: No such file or directory in C:\wamp\www\wordpress\wp-content\plugins\upload-to-dropbox\dbouploader.php on line 60

        Error: Cannot create temporary directory!

  7. docttor says:

    Great tutorial! I have made a plugin with the same Jaka Jancar Dropbox code but with some more features few weeks ago for my website.

    This is a great solution to avoid using API and making it available for any API change.

    My plugin can be viewed/bought on <a href=”http://codecanyon.net/item/dropbox-upload-form/1271544?WT.ac=new_item&WT.seg_1=new_item&WT.z_author=docttor”>codecanyon</a>.

  8. Jason says:

    !!!BUYER BEWARE!!!

    I had this plugin installed on my website for a number of months before I found out that it was being exploited for uploading content to my site: there was another site entirely living on my server?!?

    • Japh Thomson says:
      Staff

      Hi Jason, can you please clarify which plugin you’re referring to exactly?

    • Elvin says:
      Author

      Hi Jason. Please write the name of plugin which you are talking about. It seems you meant a plugin which user called Docctor described, you replied to his comment.
      But in any case, i would like to add aan explanation about my own plugin: The plugin which is given in this tutorial is open source as you see, and no any third party url. Just your site and Dropbox. So, it is impossible that such plugin can harm your site.

    • docttor says:

      It is not possible that Jason is reffering to my plugin on codecanyon.net because he said that he had this plugin installed for months and my plugin is old only for about 2 weeks.

      It is a fresh plugin and tested for a long period of time before it was launched so no need to beware of my plugin.

      This plugin allows only uploads and nothing else so it is not possible for someone to access your site through it.

      It is safe.

  9. Richard says:

    Great plugin! But I hope you can help me. I’ve added this to a wordpress site (http://dev.burmavjmedia.net) and it all works fine in IE, Firefox and Chrome.

    However, when I remove the login condition it still works fine in IE and Firefox – I can upload and I get the success message – but in Chrome after I press upload I get a 404 and nothing arrives in my Dropbox.

    It does, however, work if I am still logged into WordPress, even though the login condition was disabled.

    Can you give any advice?

    Thanks guys!
    R

  10. silvia says:

    hi! I installed the upload-to-dropbox plugin for wordpress, I configured the file config.php, and added a folder to my plugin/ and named it “dbouploader “.

    When I insert the code: [dbouploder] in a post or page it result just as a text:”[dbouploder]“.

    Have I done something wrong? Please help!

  11. Jeanne says:

    Hi Silvia and Elvin

    I had the same problem but the code must be [dbouploader] instead of [dbouploder]
    its a little type mistake.

  12. Jeanne says:

    Is it possible or an idea to use this uploader for different (self choosen) directories in dropbox? (a kind of customization)

  13. Jeanne says:

    I need more file types for uploading, so I’ve changed the config.php like this:
    $supported_types=array(‘image/png’,'image/jpeg’,'image/doc’,'image/xls’,'image/pdf’);
    $size_limit=’2000000′;

    but it doesn’t work. Can you please help me out?

    thanks

  14. qp says:

    Hi Elvin,

    Thanks for your pluggin, it works really well!

    I tried your suggestion 1:

    “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…
    if (is_user_logged_in()) add_shortcode(‘dbouploader’, ‘shortcoder’); ”

    … but when i update the file, i have some syntax error on line 29, and some “fatal error”

    As I really know (almost) nothing in coding, i may have misunderstood the lines to remove from the dbouploader.php file.

    I actually only deleted this line : “if (is_user_logged_in()) add_shortcode(‘dbouploader’, ‘shortcoder’);” and nothing else.

    My question is :
    Should i remove other lines in this file that may be linked to the part i tried to removed to make it work?

    Thanks a lot, have a nice day!
    Q.

    • Darrel says:

      qp, I couldn’t it to work by just deleting that line, either. I’m a complete n00b to this but it does seem that I’ve found a way around it:

      Place the line you deleted back where belongs and edit the line below it so combined they look like this:

      if (is_user_logged_in()) add_shortcode(‘dbouploader’, ‘shortcoder’);
      else add_shortcode(‘dbouploader’, ‘shortcoder’);

      Notice I just duplicated the true statement into the else statement underneath it by changing

      else add_shortcode(‘dbouploader’, ‘notloggedin’);

      to

      else add_shortcode(‘dbouploader’, ‘shortcoder’);

      Seems to work so far

  15. iwa says:

    Seems like an awesome plugin, but for some reason I keep getting this error message when attempting to upload a file:

    Error: Cannot execute request: Failed to connect to 199.47.217.170: Permission denied

    Could you please suggest what might be causing this error?

    Thanks.

  16. Ean says:

    I keep getting a 404 page not found not matter what browser I use, please help.

  17. tom says:

    Hi,

    i also get Errors.

    1. – I get an error when i want to edit the dropbox Plugin config.php in WP.
    2. – And i get an Error when i put the code on the site and reload the site.
    Even when the Cofig.php is original and even when the confic.php is edited in Dreamweaver.

    In both situations (1 and 2) i get this Error:
    Warning: Cannot modify header information – headers already sent by (output started at /var/www/web137/html/WP/wp-content/plugins/dbouploader/dbouploader.php:107) in /var/www/web137/html/WP/wp-includes/pluggable.php on line 890

  18. Kanabar says:

    Elvin
    You have a typo that is fatal in the WP shortcode in the WordPress instructions.
    [dbuploader]
    [dbouploader]

    Not sure how many people jumped off the bridge. Works well otherwise. you should add….pdf, doc, as well to the array.
    Thanks
    VK

    • Japh Thomson says:
      Staff

      Hi VK, I don’t see the typo that you’re referring to in the article. The shortcode is and should be [dbouploader].

      The mistake mentioned earlier in the comments is from people accidentally typing [dbouploder] instead, which won’t work.

  19. Kanabar says:

    Here is the URL:

    http://wordpress.org/extend/plugins/upload-to-dropbox/installation/

    It says [dbouploder] incorrectly.

    VK

  20. Kanabar says:

    Also Jeanne has the same question that I have:

    I need more file types for uploading, so I’ve changed the config.php like this:
    $supported_types=array(‘image/png’,’image/jpeg’,’image/doc’,’image/xls’,’image/pdf’);
    $size_limit=’2000000′;
    but it doesn’t work. Can you please help me out?

    I tried: application/pdf and application/doc and msword/doc…. none of these are supported_types.
    Also Size_limit not sure….if it can be increased to a larger number.

    Thanks
    VK

  21. tom says:

    I past the right shortcut but i always get this error on every site:
    Warning: Cannot modify header information – headers already sent by (output started at /var/www/web137/html/WP/wp-content/plugins/dbouploader/dbouploader.php:107) in /var/www/web137/html/WP/wp-includes/pluggable.php on line 890

    • Elvin says:
      Author

      Hi Tom. It seems there are blank lines in your dbouploader.php file. Open that file in editor, go to last line and remove unused lines there after ?>. That’s all.

  22. Nikolas says:

    Gives out an error : Error: Cannot extract token! (form action=https://dl-web.dropbox.com/upload)
    I can not understand what is the matter? The site is made on wordpress

  23. Justin says:

    I keep getting this message..

    Error: Cannot extract token! (form action=https://dl-web.dropbox.com/upload)

  24. Nikolas says:

    Help please, I can’t understand

  25. Morten says:

    Hey,

    for some reason it won’t with large files nomatter how high I set the file size limit. What could be the problem?

    • Elvin says:
      Author

      Hey Morten.
      I think your hosting’s php upload_max_filesize limit doesn’t let you to increase file size limit. You can get value of that limit with simple line in any php file of your site. If it is so you must change your php.ini yourself, or contact to your hosting support team.

  26. Mike says:

    Hi,

    I have installed the plugin, but when i activate it i get this error :

    Fatal error: Cannot redeclare dbouploader() (previously declared in /nfs/c10/h05/mnt/143464/domains/mydomain/html/wp-content/plugins/upload-to-dropbox/dbouploader.php:27) in /nfs/c10/h05/mnt/143464/domains/mydomain/html/wp-content/plugins/dbuploader/dbuploader.php on line 32

    Thank you for your help.

    • Elvin says:
      Author

      Hey Mike.
      It seems you have copy-pasted dbouploader.php in the plugin folder, havent’t you? This error appears when you copy-paste plugin folder or plugin file into the same directory

  27. Segmant says:

    Hi,

    great plugin, just a 1 thing i need help with.

    When the “upload” button is clicked, on error or success of the outcome it takes me to a different page instead of staying on the current page, how do i fix this?

    Thanks

    Chris

  28. tom says:

    Ok – thank you Elvin.

    I will test this (Black lines Error)

    Another Question – is it possible to Upload big WAV Sound Files or big ZIP/RAR Files?
    If yes, what i have to write in this lines:

    $supported_types=array(‘image/png’,'image/jpeg’);
    $size_limit=’512000′;

    (512000 is byte – right? So its 0,5 MB) – What about 1000MB ZIP Files? Possible?

    Thanks so much!

  29. Vadim says:

    Hey, I get this error
    Fatal error: Cannot redeclare class DropboxUploader in /home/content/30/3289730/html/pihsport/wp-content/plugins/upload-to-dropbox/DropboxUploader.php on line 28

    any idea what I’m doing wrong?

  30. Andrew says:

    Error Code :

    Error: Cannot extract token! (form action=/login)

    any idea’s??? I see that Nikolas, Justin and Karl are getting the same error message.

    Japh / Elvin please help?

  31. I’ve got the error message : Error: Cannot extract token! (form action=/login)

  32. Joe says:

    For anyone getting the error ” Error: Cannot extract token! ” go to:

    http://forums.dropbox.com/topic.php?id=10849

    For fixed code (drop box changed so code needed updating)

    MEANWHILE…

    I have:

    $supported_types=array(‘application/msword’,'application/pdf’);

    AND IT WILL NOT UPLOAD PDFS!

    It will upload docs… but not pdfs… why?!

    Thanks all :)
    Anyone got any ideas?

  33. theo says:

    I followed your instructions, but when I put the code on my page, [dbouploader] , that’s exactly what it looks like on the page. I’m not trying to sound stupid, but do I need to put it behind a button? I’m guessing that’s what I need to do.

    • Elvin says:
      Author

      Hi theo, if shortcode [dbouploader] stays unchanged, it means you haven’t activated dbouploader plugin yet.(Appearance->Plugins)

  34. JS says:

    Hi There,

    I have mine set-up and all seems to work. However when I try to upload it says:
    ‘Wrong email address. Go back.’

    I know the email address and password are correct and have verified a few times.
    How could I fix this? Is there another possible cause?

    Thanks!

  35. Joe says:

    Theo – you need to edit the plugin code in the built in plugin editor… go there and fine the one with similar code and replace it and save.

    JS – No idea what you’ve done wrong… replace everything and start over with clear caches?

    MEANWHILE… Can someone help ME with my MIME issue… I have:

    $supported_types=array(‘application/msword’,’application/pdf’);

    but it only accepts word docs and NOT pdfs… this is super super annoying!

    Anyone? Spread the love/knowledge my way a bit?

    Cheers!

    • Elvin says:
      Author

      Hello Joe. PDF Mime-type is application/pdf, you wrote it right. So it has to accept pdf files if size limit allows it. Please check your size limit.

  36. JenC says:

    Is there any way to accept CAD drawings for the uploader? .cad files? Thanks.

    • JenC says:

      Never mind…I just need the MIME type: application/autocad, application/x-autocad, image/cad, image/x-cad

  37. Jen says:

    Ok…I’m back. Adding the mime type as mentioned above does NOT work. Is there anyway to just allow it to accept ANY file? I need to get this plugin working for a client of mine. Thank you.

    • Elvin says:
      Author

      Hey Jen.
      Autocad mime types are these:
      application/acad – for cad files,
      application/dxf – for dxf files,
      application/x-dxf – for dwf files.

  38. Dave says:

    Anyway to bypass uploading it to your server and go straight to the Dropbox folder instead? I’m trying to bypass the filesize limit of my hoster.

  39. Dave says:

    Ran into another problem while using this plugin :

    Error: Cannot execute request: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

  40. Kike says:

    Excellent plugin, is very useful!!! but I have a question, How can I add support for audio and video files??

    I need that my users can upload mp4 videos and mp3 audio, I added this, but it doesn´t work

    $supported_types=array(‘image/png’,'image/jpeg’,'image/jpg’,'video/mp4′,’video/avi’,'video/avi’,'video/ogg’,'video/mpeg’,'video/mpeg4-generic’,'video/MP4V-ES’,'audio/mp3′);

  41. Michael Wieden says:

    When i read all this posts, i think this is really an excellent plugin! I installed the plugin, but after trying to upload, message “Error: Cannot create temporary directory!” appears. Didn`t found anyone with the same problem. Maybe someone can help?

    Best regards
    Michael

  42. Elvin says:
    Author

    If you have any problem with this plugin, you can download the latest version here, which works fine: http://wordpress.org/extend/plugins/dropbox-plugin/

  43. Elvin says:
    Author

    Sorry. I wrote wrong url above. Here is correct one:
    http://wordpress.org/extend/plugins/upload-to-dropbox

  44. frank says:

    I am having problems setting this up is it possible to call someone for help?

    Thank you,
    Frank

    Click this link below to sync your images now! This is recomended for your first install or if some images have not synced. This will take a long time! It may take 5-10 min for the syncing to complete. Please wait for a list of the uploaded files before loading a different page.
    HERE
    Uploaded: ../../uploads/2012/03/1-1000×250.jpg

    Fatal error: Uncaught exception ‘Exception’ with message ‘Cannot extract token! (form action=/login)’ in /home/content/01/8400201/html/wp-content/plugins/dropbox-sync/upload_function.php:140 Stack trace: #0 /home/content/01/8400201/html/wp-content/plugins/dropbox-sync/upload_function.php(86): DropboxUploader->extractToken(‘HTTP/1.1 200 OK…’, ‘/login’) #1 /home/content/01/8400201/html/wp-content/plugins/dropbox-sync/upload_function.php(74): DropboxUploader->login() #2 /home/content/01/8400201/html/wp-content/plugins/dropbox-sync/sync.php(39): DropboxUploader->upload(‘../../uploads/2…’, ‘public/uploads/…’) #3 /home/content/01/8400201/html/wp-content/plugins/dropbox-sync/sync.php(84): db_upload(‘../../uploads/2…’, ‘public/uploads/…’) #4 {main} thrown in /home/content/01/8400201/html/wp-content/plugins/dropbox-sync/upload_function.php on line 140

Add a Comment

To add a code snippet to your comment, please wrap your code like so: <pre name="code" class="html">YOUR CODE</pre>. You can replace the class name with "js," "css," "sql," or "php." If there are any "<" or ">" within your code, please search and replace them with: &lt; and &gt; respectively.