UploaDrop [A Dropbox based File Uploading Solution of large files]

What is it?
UploaDrop is a dropbox based upload script which is used for uploading files and folders to dropbox instead of server storage.

Most of the time, we, the developers, must have to manipulate large files on the website like videos, audios or other documents. If the unit size of files is small, then its okey. There is no big deal to handle these files of small size. But when the application requires to upload files of large size like 5GB on each upload, we need to consider the reliablity of the upload script. We need to consider the maximum size of files which can be uploaded. We need to consider the maximum bandwidth we can use at a time. We have to take the burden of server optimization.

To get rid of these headache, we can handle this file manipulation tasks to other 3rd party who is already established with the service of file manipulation.

Dropbox is cloud based file hosting server in which users can upload their files and can download when needed. Dropbox has provided lots of features including large file uploading with optimized way.

Dropbox has also provided an api which is highly user-friendly so that any developer can use that.

To develop a script in which visitors/users of the application can upload file via drag drop or choosing. Instead of the hosting space, these files will be uploaded on dropbox space of the owner of the application. Then these files can be used for different purposes.

1. Multiple files uploading at a time
2. File uploading to owner’s dropbox storage
3. No need to have headache about file manipulation, storage, bandwidth of file uploading.
4. Recrsively finds every files from all folders and uploads to dropbox

First of all I would like to thank the Dropbox Team for providing this awesome service.

Then I thank Mr. Nuhil Mehdy (nuhil.net) to give me the idea.

Lets start the development of an simple application called UploaDrop by which end user will upload something to your website, and instead of your host, it will be uploaded on dropbox.

When you are a Developer
The first task is to create an app on your Dropbox account using developer account.

1. Go to https://www.dropbox.com/developers/apps and Click on “Create app” button.

2. Fill these given fields as the picture shows.

3. After completing the creation of your app you will see the details of your app by going https://www.dropbox.com/developers/apps and click on the App Name ‘UploaDrop’.

See the rounded area which provides app key and app secret. These two key defines the access of your dropbox account for uploading from outside.

4. Now open composer.json for editing and set these keys on this like the picture shows.

5. OK, In this step you are all set. Now lets get the access key. Execute getAccesskey.php on the browser which returns a url like


6. Copy this url and paste on the browser. It will ask for permission to create a folder named app name on the dropbox account.

Click on “Allow”

7. An access key will be displayed like the given screenshot.

Save the Access key on some secured place.

8. Open index.php and and edit the $accesskey field on line 10.

Open processupload.php and do the same task on line 5.

Here, developer’s work is finished. All configuration is finished.

Front End behavior
1. Hit “index.php” on the browser, the front end page will be arrived.

2. In the drag&drop area, user can drag&drop their files and folders. A progress bar will be shown for each of the files when uploading. After completation of uploading of all files click on “Finish Uploading”.

This is the simple app. Actually, It is a brief instruction of how to use Dropbox Core Api.

Future Works
1. In the top area, all existing files are being displayed in recursive structure which is coded by me. In dropbox core api, there are options to create download link of each files, Editing, Deleting etc. These 3 features can be achieved in future.

2. If any compressed file is drop on the drag&drop area, it doesnt extract the compressed file. In future, it can be an issue.

Source Code (Github)
Watch Demo

Removing index.php from url of CodeIgnitor project | Using .htaccess file

Step 1 : Edit the configuration file to give the permission to override default settings.
command: sudo nano /etc/apache2/sites-available/default
Change the value of AllowOverride to ‘All’ from ‘none’


    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
        Options FollowSymLinks
        AllowOverride All                                 <- HERE
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All                                 <- HERE
        Order allow,deny
        allow from all

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from ::1/128

Step 2: Enable module rewrite
command: sudo a2enmod rewrite

Step 3: Restart apache server
command: sudo service apache2 restart

sample .htaccess:

RewriteEngine on
RewriteCond $1 !^(index.php|images|robots.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

N.B: Don’t forget to press Enter once at the end of the htaccess file.Because Newline represents the end of file.


Creating AutoBack Up of MySQL Database using JAVA OR PHP ( পিএচপি অথবা জাভা তে কিভাবে মাইএসকিউএল ডাটাবেজ এর অটোমেটিক ব্যাকআপ করতে হয় )

It is usual that we need to backup the database in software development (specially in Enterprise Software,web applications ) Database is very important which contains all the information about the organization. Last night I have coded a auto backup script in both JAVA and PHP. Here I am gonna post them below with comment.

Code Written in JAVA

 * To change this template, choose Tools | Templates
 * and open the template in the editor.
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.*;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
 * @author Ujjal Suttra Dhar

class create_backup{

    String database = "your_database_name",  user = "root", password = "pass";
    Connection m_Connection = null;
    Statement m_Statement = null;
    ResultSet m_ResultSet;
    String m_Driver = "com.mysql.jdbc.Driver";
    String m_Url = "jdbc:mysql://localhost:3306/" + database;

    public create_backup(){

        /*Eshtablishment of Connection of java code with MySQL using JDBC
         You must read my previous post to know further about this. 
        try {
            m_Connection = DriverManager.getConnection(m_Url, user, password);
            //Create Statement object
            m_Statement = m_Connection.createStatement();

        } catch (Exception ex) {

        try {
            //Database will be stored in filename.sql which can be import on MySQl as backup
            BufferedWriter  out = new BufferedWriter(new FileWriter(&quot;kernel_school.sql&quot;));

            //Now here is the informations about the database of which backup will be created
            String dump = &quot;C:/Program Files/MySQL/MySQL Server 5.0/bin/mysqldump &quot; //Path to mysql
                    + "--host=localhost" //Mysql hostname
                    + "--port=3306" //Mysql portnumber
                    + "--user=root" //Mysql username
                    + "--password=pass" //Mysql password
                    + "--add-drop-table" //Add a DROP TABLE statement before each CREATE TABLE statement
                    + "--add-drop-database" //Add a DROP DATABASE statement before each CREATE DATABASE statement
                    + "--complete-insert" //Use complete INSERT statements that include column names.
                    + "--extended-insert" //Use multiple-row INSERT syntax that include several VALUES lists
                    + "kernel_school";                  //Mysql databasename

            //executing the command through process.
            Process run = Runtime.getRuntime().exec(dump);

            /*resultant SQL informations are here on the br which can be read line by line .
            And at the same time it will be written on another sql file.*/
            InputStream in = run.getInputStream();
            InputStreamReader isr = new InputStreamReader(in);
            BufferedReader br = new BufferedReader(isr);
            String line = null;

            while ((line = br.readLine())!=null) {

       out.flush(); // must flush or close the file after completing the task.
        // int exitVal = run.waitFor();//when exitVal is ,then the process is completed

        } catch (Throwable t) {

 } // class

public class autobackup {
    public static void main(String a[]){
            new create_backup();

Code Written in PHP

Sending mail from php

Today I am going to post a simple method to send mail from php code.To this we must use SMTP [Simple Mail Transfer protocol]which uses default port that is 25.Before sending mail,SMTP server name must be included in php.ini .To make our job easier I will use three php files.
They are
01: SMTPconfig.php
02: SMTPclass.php
03: index.php

01: SMTPconfig.php

//Server Address
$SmtpPort=”25″; //default

Here,SMTP server setup is completed.

02: SMTPclass.php

class SMTPClient

function SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body)

$this->SmtpServer = $SmtpServer;
$this->SmtpUser = base64_encode ($SmtpUser);
$this->SmtpPass = base64_encode ($SmtpPass);
$this->from = $from;
$this->to = $to;
$this->subject = $subject;
$this->body = $body;

if ($SmtpPort == “”)
$this->PortSMTP = 25;
$this->PortSMTP = $SmtpPort;

function SendMail ()
if ($SMTPIN = fsockopen ($this->SmtpServer, $this->PortSMTP))
fputs ($SMTPIN, “EHLO “.$HTTP_HOST.”rn”);
$talk[“hello”] = fgets ( $SMTPIN, 1024 );
fputs($SMTPIN, “auth loginrn”);
fputs($SMTPIN, $this->SmtpUser.”rn”);
fputs($SMTPIN, $this->SmtpPass.”rn”);
fputs ($SMTPIN, “MAIL FROM: from.”>rn”);
$talk[“From”] = fgets ( $SMTPIN, 1024 );
fputs ($SMTPIN, “RCPT TO: to.”>rn”);
$talk[“To”] = fgets ($SMTPIN, 1024);
fputs($SMTPIN, “DATArn”);
$talk[“data”]=fgets( $SMTPIN,1024 );
fputs($SMTPIN, “To: to.”>rnFrom: from.”>rnSubject:”.$this->subject.”rnrnrn”.$this->body.”rn.rn”);
fputs ($SMTPIN, “QUITrn”);
return $talk;

03: index.php

$to = “to_mailid”;
$from = “from_mailid”;
$subject = “subject”;
$body = “message”;
$SMTPMail = new SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body);
$SMTPChat = $SMTPMail->SendMail();

Thanks for visiting this…
For more info Click Here