Created
September 11, 2012 23:02
-
-
Save plasticbrain/3702841 to your computer and use it in GitHub Desktop.
PHP: Upload and parse CSV file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="" method="post" accept-charset="utf-8" enctype="multipart/form-data"> | |
<input type="file" name="file"> | |
<input type="submit" name="btn_submit" value="Upload File" /> | |
<?php | |
$fh = fopen($_FILES['file']['tmp_name'], 'r+'); | |
$lines = array(); | |
while( ($row = fgetcsv($fh, 8192)) !== FALSE ) { | |
$lines[] = $row; | |
} | |
var_dump($lines); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there any way to insert the resulting array into sql table?