0
我使用BootstrapValidation驗證PhpExcel的文件。'PHPExcel_Reader_Exception'消息'無法打開閱讀!文件不存在。'
Fatal error: Uncaught exception 'PHPExcel_Reader_Exception' with message 'Could not open for reading! File does not exist.'
1:如何設置驗證不僅接受的.xls但整個文件名(file.xls)?
2:文件不POST? (見腳本)
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"];
HTML - >您忘記設置加密** ENCTYPE = 「的multipart/form-data的」 ** – donald123 2014-10-28 11:42:29
@ donald123我已經嘗試過,但仍然沒有! – N1CKN4M3 2014-10-28 13:18:33