I have a serious problem here. I am trying to upload a file into a database. the flat file is simple data delimited with a comma....
I have tried two different methods to upload the data... both are timing out while uploading a 1Mb file with 4,000 entries. That isn't really alot of data. Can someone tell me why this would start timing out all the sudden?
if (move_uploaded_file($_FILES['nacsfile']['tmp_name'], $uploadfile)){
/* //Read File
$row = 1;
$fp = fopen ($uploadfile, "r");
while ($data = fgetcsv($fp,1000,",")){
$num = count($data);
//set Data to Variables */
$fcontents = file($uploadfile);
for($i=0; $i<sizeof($fcontents); $i++) {
$line = trim($fcontents[$i]);
$data = explode(",", $line);
$company_ID = $data[0];
$company_ID2 = $data[1];
$type_of_transaction = $data[2];
$ignore1 = $data[3];
$deal_ID = $data[4];
$our_company_name = $data[5];
$customer_full_name = $data[6];
$payment_ID = $data[7];
$ignore2 = $data[8];
$ignore3 = $data[9];
$ignore4 = $data[10];
$ignore5 = $data[11];
$debit = $data[12];
$amount = $data[13];
$transaction_description = $data[14];
$ignore6 = $data[15];
$bank_name = $data[16];
$bank_phone = $data[17];
$bank_routing_num = $data[18];
$bank_account_num = $data[19];
$check = $data[20];
$ignore7 = $data[21];
$ignore8 = $data[22];
$ignore9 = $data[23];
$cust_address = $data[24];
$ignore10 = $data[25];
$city = $data[26];
$state = $data[27];
$zip_code = $data[28];
$ignore11 = $data[29];
$ignore12 = $data[30];
$ignore13 = $data[31];
$sql = "INSERT IGNORE INTO nacs_file (`company_ID`, `company_ID2`, `type_of_transaction`, `ignore1`, `deal_ID`, `our_company_name`, `customer_full_name`, `payment_ID`, `ignore2`, `ignore3`, `ignore4`, `ignore5`, `debit`, `amount`, `transaction_description`, `ignore6`, `bank_name`, `bank_phone`, `bank_routing_num`, `bank_account_num`, `check`, `ignore7`, `ignore8`, `ignore9`, `cust_address`, `ignore10`, `city`, `state`, `zip_code`, `ignore11`, `ignore12`, `ignore13`) VALUES ('$company_ID', '$company_ID2', '$type_of_transaction', '$ignore1', '$deal_ID', '$our_company_name', '$customer_full_name', '$payment_ID', '$ignore2', '$ignore3', '$ignore4', '$ignore5', '$debit', '$amount', '$transaction_description', '$ignore6', '$bank_name', '$bank_phone', '$bank_routing_num', '$bank_account_num', '$check', '$ignore7', '$ignore8', '$ignore9', '$cust_address', '$ignore10', '$city', '$state', '$zip_code', '$ignore11', '$ignore12', '$ignore13')";
$r1 = mysql_query($sql, $dbConn)or die("<br>Error: ". mysql_error());
if(mysql_error()) {
echo mysql_error() ."<br>\n";
}
}
/* }//end While Loop
fclose($fp);
//End Read File */
the commented code is the first method I was using. It worked for smaller files but is timing out with the bigger files...