2017-11-04 107 views
-1

我試圖導入CSV的多行到SQL,並且此代碼僅使用少量行數(例如75行)導入,它會成功,但是當我試圖在SQL中導入多行數據(例如700000行)時,會出現。導入大尺寸的CSV到SQL得到了這個警告:fopen():文件名不能爲空

enter image description here

if(($handle = fopen($_FILES['file']['tmp_name'], 'r')) !== false) 
    { 
    $header = fgetcsv($handle); 
    while(($data = fgetcsv($handle)) !== false){ 
    $sql = "INSERT into mansfield_barcode.dbo.".$_POST['uploadSName']." values('".implode("','", $data)."')"; 
    $result = mssql_query($sql); 
    unset($data); 

    if(! $result){ 
    echo "<script type=\"text/javascript\"> 
    alert(\"Invalid File:Please Upload CSV File.\"); 
    window.location = \"sku.php\" 
    </script>"; 
    } 
    } 
    fclose($handle); 
    echo "<script type=\"text/javascript\"> 
    alert(\"CSV File has been successfully Imported.\"); 
    window.location = \"sku.php\" 
    </script>"; 
    } 
+1

檢查您的php.ini文件的upload_tmp_dirpost_max_size以及upload_max_filesize的值。 – JDpawar

回答

0

通過改變

post_max_size = 64M 
upload_max_filesize = 64M 

在php.ini

感謝JDpawar解決了這個問題

相關問題