0

I have an excel application exporting data in .csv format (thousands of rows) which I need to upload quickly on the mysql server located on my website hosting server (in my case it is GoDaddy). Since the dataset is large, I can't upload the data through multiple strings or one by one row.

I have already tried importing .csv file on mysql server using Load data local infile method. It works great when the mysql server is installed locally but fails completely when I try this on mysql server installed on website hosting because mysql user does not have the ftp folder access due to security issues.

My questions:

  1. What would be the best way to upload bulk data to mysql installed on my website hosting using Excel VBA?
  2. I have found out using Google that using a PHP script is an option. Can somebody please suggest a good reference on how to achieve that?
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • [Reports in Codeigniter](http://stackoverflow.com/questions/11189021/reports-in-codeigniter/11189368#11189368) – Muhammad Raheel May 24 '14 at 07:17
  • The [documentation](http://dev.mysql.com/doc/refman/5.1/en/load-data.html) tells "If **LOCAL** is specified, the file is **read by the client program on the client host** and sent to the server." But you must have the [**FILE**](http://dev.mysql.com/doc/refman/5.1/en/privileges-provided.html#priv_file) privilege – Sir Rufo May 24 '14 at 07:40

1 Answers1

1

here is one standard method :

<?php
include_once($_SERVER['DOCUMENT_ROOT'].'/library/common.php');

class csvreadController
{
    function csvimport()
    {   
        $filePath['file']= SITE_ROOT."upload/csvimport.csv";

        $uploads_dir = '<?php echo SITE_PATH?>uploads/';
        $name ="csvimport";
        $file = $_FILES["csv"]["tmp_name"];


        if(move_uploaded_file($file, $uploads_dir.$name)) 
            {
                echo "imported";
            } 
        else 
            {
                echo "not imported";die;
            }
        $filePath=$uploads_dir.$name;*/
    }

}
?>
  • The original question is very pertinent to something I've been working on and have faced the same limitations. I'm new to PHP and therefore seeking a little wording surrounding how the above works and what / where do I get the common.php that is linked? – Palendrone Feb 26 '15 at 10:53