I need to import data xlsx to a system I've created.
HTML
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="arquivo">
<input type="submit" name="pegar value="pegar">
</form>
PHP
<?php
ini_set('display_errors', true);
error_reporting(E_ALL);
if (isset($_POST['pega'])) {
$arquivo = $_FILES['arquivo'];
$file = fopen($arquivo,"r");
while(! feof($file)){
echo fgets($file). "<br />";
}
fclose($file);
}
And these are the error messages that appear:
Warning: fopen () expects parameter 1 to be a valid path, array given in /Applications/MAMP/htdocs/sistemas/scripts_da_web/php/importaCSV.php online 20
Warning: feof () expects parameter 1 to be resource, boolean given in /Applications/MAMP/htdocs/sistemas/scripts_da_web/php/importaCSV.php online 22
Warning: fgets () expects parameter 1 to be resource, boolean given in /Applications/MAMP/htdocs/sistemas/scripts_da_web/php/importaCSV.php online 24