我正在使用PHPExcelReader解析一个excel文件(由用户从他们的本地机器中选择)。PHP将获取这些值,并将其存储在数组中,然后重新组织,并以表的形式在屏幕上显示。
但是,在浏览文件之后,一旦单击"Submit",就会得到错误:File not found
下面是HTML:
<div class="row-fluid" style="margin-top:15px">
<h2>Step 1: Import the file</h2>
<p>Once uploaded, the window will display a preview of the document. Please check to make sure the column
headers match the data before uploading.</p>
<form action="../scripts/previewFile.php" method="post" enctype="multipart/form-data">
<input type="file" name="fileToUpload" />
<input type="submit" value="Preview File" name="submit">
<div id="filePreview" style="height: 500px; overflow: scroll;">
</div>
</form>
</div>调用的previewFile.php文件:
function previewFile()
{
$filePath = $_FILES['file']['tmp_name'];
$excel = new Spreadsheet_Excel_Reader; // creates object instance of the class
$excel->read($filePath);
}更新错误为文件"previewFile.php“的404,该文件被调用为操作。
不确定我的URL "../scripts/previewFile.php"有什么问题
下面是我的模式:
root
|_views
|_default
|_assets
|_scripts
|_previewFile.php
|_templates
|_step1.php <- the html file with the input tags发布于 2015-09-22 20:32:13
您的输入名为fileToUpload,您正在查找$_FILES数组中的file,因此应该如下所示:
function previewFile()
{
$filePath = $_FILES['fileToUpload']['tmp_name'];
$excel = new Spreadsheet_Excel_Reader; // creates object instance of the class
$excel->read($filePath);
}https://stackoverflow.com/questions/32726181
复制相似问题