Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // $fileData is a uploaded file
- // I uploaded a jpeg and a tar.gz file and get NO error
- ob_start();
- if (($handle = fopen($fileData['tmp_name'], "r")) !== FALSE) {
- while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
- $num = count($data);
- echo "<p> $num fields in line $row: <br /></p>\n";
- $row++;
- for ($c=0; $c < $num; $c++) {
- echo $data[$c] . "<br />\n";
- }
- }
- fclose($handle);
- return ob_get_clean();
- // Sample Output
- /*
- 1 fields in line :
- JFIF��@ExifMM*�i�@�@��C
- 1 fields in line 1:
- 1 fields in line 2:
- ��C��@@"��
- 1 fields in line 3:
- �}!1AQa"q2���#B��R��$3br�
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement