[英]'PHPExcel_Reader_Exception' with message 'Could not open for reading! File does not exist.'
我使用BootstrapValidation来验证PhpExcel的文件。
Fatal error: Uncaught exception 'PHPExcel_Reader_Exception' with message 'Could not open for reading! File does not exist.'
1:如何将验证设置为不仅接受.xls,还接受整个文件名(file.xls)?
2:文件不发布? (请参见脚本)
HTML :(我需要input name ="avatar"
才能启动BootstrapValidation)
<form id="fileForm" class="form-horizontal well" action='php/import_excel.php' method="post">
<div class="form-group">
<h4>Välj fil...</h4>
<div class="col-sm-12">
<input type="file" class="form-control" id="file" name="avatar" />
</div>
</div>
<div class="pull-right">
<button type="submit" id="Import" name="Import" class="btn btn-primary button-loading" data-loading-text="Loading...">Ladda upp</button>
</div>
<br />
</form>
JS:
$(document).ready(function() {
$('#fileForm').bootstrapValidator({
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
avatar: {
validators: {
file: {
extension: 'xls',
type: 'application/vnd.ms-excel',
message: 'Välj: lkbkom.xls'
}
}
}
}
});
});
PHP:
if(isset($_POST["Import"])){
echo $path=$_FILES["file"]["tmp_name"];
错误是在.JS
fields: {
avatar: {
应该:
fields: {
file: {
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.