Closed insaurabh closed 5 years ago
Csv::parse()
function directly with it."tmp_name"
value to Csv::auto()
or Csv::parse()
. There is no need to call move_uploaded_file()
.I am not aware of any function specific for file uploads.
If you need more help to the same topic, feel free to add to the discussion here. Otherwise, close this issue. Thanks!
You are always welcome to open another issue later.
@Fonata
Thank for your suggestion, as if i use the tmp_name
i am getting the data.
A sample code without any validation, i used this just to validate.
if (isset($_POST["submit"])) {
if ($_FILES["fileToUpload"]["size"] > 0) {
$target_file = $_FILES["fileToUpload"]["tmp_name"];
$csv = new ParseCsv\Csv();
$csv->auto($target_file);
$data = $csv->data;
foreach ($data as $key => $value) {
print_r($value);
echo "<br/>";
}
}
}
It's not an issue, just a query or a feature request in general.
Is there any method available by which we can use it with a file uploader.
Currently, I uploaded the file in a folder and then passed the file to the method to get the csv data.