+ 2
upload file with PHP
how to get the content of the upload csv files using the php?
4 ответов
+ 4
http://php.net
It has a whole article about file uploading.
+ 2
that php script works out of the box:
https://blueimp.github.io/jQuery-File-Upload/basic-plus.html (demo)
built in security. just download to your ftp and access from domain name
+ 1
use file function of php
0
this code works on a single csv file only...but what i wanted to do is..every csv file I uploaded i can view the content of the specific file to another form. Anyone can help?
<?php
$csvFile = file('sample.csv');
foreach ($csvFile as $line) {
$data[] = str_getcsv($line);
}
echo "<br /><br />";
$length = count($data);
echo "<table border=1>";
echo "<thead>";
echo "<tr>";
foreach ($data[1] as $value) {
echo "<td>";
echo $value;
echo"</td>";
}
echo "</tr>";
echo "</thead>";
echo "<tbody>";
for ($i=2; $i < $length; $i++) {
echo "<tr>";
foreach ($data[$i] as $row)
{
echo "<td>";
echo $row;
echo "</td>";
}
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
?>