RE: Stuck trying to upload and grab file name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I wanted to start off by saying thank you to the list for your warm support.

I was working with jonez from irc.oftc.net #php and we were able to far
enough into the issue for me to realize I'm an idiot.

I am creating a new table like I wanted but should be creating new field due
to a little paradox I create myself with the need for at least one field in
the creation process.

I should be creating a new field anyways.

 

Here is the updated code but it will be changing a lot in a few moments.

 

 

<?php

var_dump($_FILES);

//db connection

require 'dbConnect.php';

//session file

require_once('../auth.php');

function uploadList(){

        $file = $_FILES["file"];

        $memberID = $_SESSION["SESS_MEMBER_ID"];

        if ($file["type"] == "text/plain")

                {

                if ($file["error"] > 0)

                        {

                        echo "Return Code: " . $file['error'] . "<br />";

                }

                else

                        {

                        dbConnect();

                        mysql_select_db('mailList') or die(mysql_error());

                        $tmp_name =  $file["tmp_name"];

                        //$presql = "CREATE TABLE IF NOT EXISTS
{$memberID}_{$file}";

                        $presql = "CREATE TABLE IF NOT EXISTS dumb_table";

                        $sql = <<<EOF

                        LOAD DATA LOCAL INFILE '{$tmp_name}'

                        INTO TABLE `'{$memberID}_{$file}'`

                        FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY
'\\''

                        LINES TERMINATED BY "\\r\\n"

                        IGNORE 1 LINES

EOF;

                        mysql_query($presql);

                        mysql_query($sql);

                        //var_dump($sql);

                        echo '$sql';

                        if(mysql_error())

                                {

                                echo(mysql_error());

                        }

                        else

                                {

                                print('Import of campaign emails sucessfull
into mysql table.');

                        }

                }

        }

        else

                {

                print('Invalid file type. Please make sure it is a text
file.');

        }

}

 

//var_dump($_FILES);

uploadList();

?>


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux