Forked from plasticbrain/upload-and-parse-csv-file.php
Created
September 30, 2015 07:16
-
-
Save imvaskii/f998b0ab9f0495249618 to your computer and use it in GitHub Desktop.
PHP: Upload and parse CSV file
This file contains hidden or 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