Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
纵之格
SchoolCMS
提交
46c66848
S
SchoolCMS
项目概览
纵之格
/
SchoolCMS
通知
11
Star
2
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SchoolCMS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
46c66848
编写于
4月 12, 2017
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
excel上传文件错误码处理
上级
fd11a90a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
54 addition
and
7 deletion
+54
-7
Application/Admin/Controller/FractionController.class.php
Application/Admin/Controller/FractionController.class.php
+4
-3
Application/Admin/Controller/StudentController.class.php
Application/Admin/Controller/StudentController.class.php
+4
-3
Application/Admin/View/Default/Lib/ExcelWinHtml.html
Application/Admin/View/Default/Lib/ExcelWinHtml.html
+1
-1
Application/Common/Common/function.php
Application/Common/Common/function.php
+32
-0
Application/Common/Lang/zh-cn.php
Application/Common/Lang/zh-cn.php
+13
-0
未找到文件。
Application/Admin/Controller/FractionController.class.php
浏览文件 @
46c66848
...
...
@@ -110,10 +110,11 @@ class FractionController extends CommonController
$this
->
error
(
L
(
'common_unauthorized_access'
));
}
// 文件是否上传
if
(
empty
(
$_FILES
[
'excel'
][
'tmp_name'
]))
// 文件上传校验
$error
=
FileUploadError
(
'excel'
);
if
(
$error
!==
true
)
{
$this
->
ajaxReturn
(
L
(
'common_select_file_tips'
)
,
-
1
);
$this
->
ajaxReturn
(
$error
,
-
1
);
}
// excel驱动
...
...
Application/Admin/Controller/StudentController.class.php
浏览文件 @
46c66848
...
...
@@ -112,10 +112,11 @@ class StudentController extends CommonController
$this
->
error
(
L
(
'common_unauthorized_access'
));
}
// 文件是否上传
if
(
empty
(
$_FILES
[
'excel'
][
'tmp_name'
]))
// 文件上传校验
$error
=
FileUploadError
(
'excel'
);
if
(
$error
!==
true
)
{
$this
->
ajaxReturn
(
L
(
'common_select_file_tips'
)
,
-
1
);
$this
->
ajaxReturn
(
$error
,
-
1
);
}
// excel驱动
...
...
Application/Admin/View/Default/Lib/ExcelWinHtml.html
浏览文件 @
46c66848
...
...
@@ -7,7 +7,7 @@
<div
class=
"am-popup-bd"
>
<!-- win form start -->
<form
class=
"am-form form-validation excel-form"
action=
"{{$excel_import_form_url}}"
method=
"POST"
request-type=
"ajax-fun"
request-value=
"ExcelImportCallback"
enctype=
"multipart/form-data"
>
<input
type=
"hidden"
name=
"max_file_size"
value=
"{{:MyC('home_max_limit_
image', 2048
000)}}"
/>
<input
type=
"hidden"
name=
"max_file_size"
value=
"{{:MyC('home_max_limit_
file', 51200
000)}}"
/>
<div
class=
"am-alert am-radius am-alert-tips m-t-0"
data-am-alert
>
<notempty
name=
"excel_import_format_url"
>
<p
class=
"m-b-0"
><a
href=
"{{$excel_import_format_url}}"
class=
"cr-blue"
>
{{:L('common_excel_format_download_name')}}
</a><span
class=
"m-r-5"
></p>
...
...
Application/Common/Common/function.php
浏览文件 @
46c66848
...
...
@@ -8,6 +8,38 @@
* @datetime 2016-12-01T21:51:08+0800
*/
/**
* [FileUploadError 文件上传错误校验]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-04-12T17:21:51+0800
* @param [string] $name [表单name]
* @return [mixed] [true | 错误信息]
*/
function
FileUploadError
(
$name
)
{
// 是否存在该name表单
if
(
empty
(
$_FILES
[
$name
]))
{
return
L
(
'common_select_file_tips'
);
}
// 是否正常
if
(
$_FILES
[
$name
][
'error'
]
==
0
)
{
return
true
;
}
// 错误码对应的错误信息
$file_error_list
=
L
(
'common_file_upload_error_list'
);
if
(
isset
(
$file_error_list
[
$_FILES
[
$name
][
'error'
]]))
{
return
$file_error_list
[
$_FILES
[
$name
][
'error'
]];
}
return
L
(
'common_unknown_error'
);
}
/**
* [LangValueKeyFlip 公共数据翻转]
* @author Devil
...
...
Application/Common/Lang/zh-cn.php
浏览文件 @
46c66848
...
...
@@ -87,6 +87,7 @@ return array(
'common_on_fill_in_the_text'
=>
'未填写'
,
'common_select_file_text'
=>
'选择文件'
,
'common_select_file_tips'
=>
'请选择需要上传的文件'
,
'common_unknown_error'
=>
'未知错误'
,
'common_library_email_empty_error'
=>
'收件邮箱不能为空'
,
'common_library_content_empty_error'
=>
'发送内容不能为空'
,
...
...
@@ -419,6 +420,18 @@ return array(
'am-badge-danger'
,
),
// 文件上传错误码
'common_file_upload_error_list'
=>
array
(
1
=>
'文件大小超过服务器允许上传的最大值'
,
2
=>
'文件大小超出浏览器限制,查看[{站点设置->文件最大限制}是否大于该值]'
,
3
=>
'文件仅部分被上传'
,
4
=>
'没有找到要上传的文件'
,
5
=>
'没有找到服务器临时文件夹'
,
6
=>
'没有找到服务器临时文件夹'
,
7
=>
'文件写入失败'
,
8
=>
'文件上传扩展没有打开'
,
),
// 正则
// 用户名
'common_regex_username'
=>
'^[A-Za-z0-9_]{5,18}$'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录