源码如下:
<?php
if(isset($_POST['upcsv'])){
if("application/vnd.ms-excel"!=$_FILES['upfile']['type']){
echo "<script>alert('文件格式不确')</script>"; return false;
}
else{
$csvfile=fopen($_FILES['upfile'],"r");
while($data=fgetcsv($csvfile)){
print_r($data);
}
fclose($csvfile);
}
}
?>
<form method="post" action="?" enctype="multipart/form-data">
<input type="file" name="upfile" id="upfile">
<input type="submit" name="upcsv" value="上传">
</form>
流览报错
Warning: fopen() expects parameter 1 to be string, array given in D:\AppServ\www\srctec\test_csv.php on line 18Warning: fgetcsv() expects parameter 1 to be resource, boolean given in D:\AppServ\www\srctec\test_csv.php on line 19Warning: fclose(): supplied argument is not a valid stream resource in D:\AppServ\www\srctec\test_csv.php on line 22请高人指教
<?php
if(isset($_POST['upcsv'])){
if("application/vnd.ms-excel"!=$_FILES['upfile']['type']){
echo "<script>alert('文件格式不确')</script>"; return false;
}
else{
$csvfile=fopen($_FILES['upfile'],"r");
while($data=fgetcsv($csvfile)){
print_r($data);
}
fclose($csvfile);
}
}
?>
<form method="post" action="?" enctype="multipart/form-data">
<input type="file" name="upfile" id="upfile">
<input type="submit" name="upcsv" value="上传">
</form>
流览报错
Warning: fopen() expects parameter 1 to be string, array given in D:\AppServ\www\srctec\test_csv.php on line 18Warning: fgetcsv() expects parameter 1 to be resource, boolean given in D:\AppServ\www\srctec\test_csv.php on line 19Warning: fclose(): supplied argument is not a valid stream resource in D:\AppServ\www\srctec\test_csv.php on line 22请高人指教
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货