翻译文件上传操作的返回信息
This commit is contained in:
parent
529f11c7a1
commit
dd95455e64
|
@ -46,27 +46,27 @@ class files{
|
||||||
$dir_name = empty($dir) ? 'image' : trim($dir);
|
$dir_name = empty($dir) ? 'image' : trim($dir);
|
||||||
//检查文件名
|
//检查文件名
|
||||||
if (!$file_name) {
|
if (!$file_name) {
|
||||||
$msg['error'] = "请选择文件。";
|
$msg['error'] = "Select the file !";
|
||||||
}
|
}
|
||||||
//检查目录
|
//检查目录
|
||||||
else if (@is_dir($save_path) === false) {
|
else if (@is_dir($save_path) === false) {
|
||||||
$msg['error'] = "上传目录不存在。请联系管理员";
|
$msg['error'] = "System error.Plase contact the administrator for help";
|
||||||
}
|
}
|
||||||
//检查目录写权限
|
//检查目录写权限
|
||||||
else if (@is_writable($save_path) === false) {
|
else if (@is_writable($save_path) === false) {
|
||||||
$msg['error'] = "上传目录没有写权限。请联系管理员";
|
$msg['error'] = "System error.Plase contact the administrator for help";
|
||||||
}
|
}
|
||||||
//检查是否已上传
|
//检查是否已上传
|
||||||
else if (@is_uploaded_file($tmp_name) === false) {
|
else if (@is_uploaded_file($tmp_name) === false) {
|
||||||
$msg['error'] = "临时文件可能不是上传文件。或者文件类型不在允许的范围内,请重新上传";
|
$msg['error'] = "System error.Plase re-try";
|
||||||
}
|
}
|
||||||
//检查文件大小
|
//检查文件大小
|
||||||
else if ($file_size > $max_size) {
|
else if ($file_size > $max_size) {
|
||||||
$msg['error'] = "上传文件大小超过限制。";
|
$msg['error'] = "You file too large";
|
||||||
}
|
}
|
||||||
//检查目录名
|
//检查目录名
|
||||||
else if (empty($ext_arr[$dir_name])) {
|
else if (empty($ext_arr[$dir_name])) {
|
||||||
$msg['error'] = "目录名不正确。";
|
$msg['error'] = "System error.Plase contact the administrator for help";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@ class files{
|
||||||
$file_ext = strtolower($file_ext);
|
$file_ext = strtolower($file_ext);
|
||||||
//检查扩展名
|
//检查扩展名
|
||||||
if (in_array($file_ext, $ext_arr[$dir_name]) === false) {
|
if (in_array($file_ext, $ext_arr[$dir_name]) === false) {
|
||||||
$msg['error'] = "上传文件扩展名是不允许的扩展名。\n只允许" . implode(",", $ext_arr[$dir_name]) . "格式。";
|
$msg['error'] = "File type is not allowed.\n allowed extension:" . implode(",", $ext_arr[$dir_name]) . "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -125,7 +125,7 @@ class files{
|
||||||
$file_path = $save_path . $new_file_name;
|
$file_path = $save_path . $new_file_name;
|
||||||
|
|
||||||
if (move_uploaded_file($tmp_name, $file_path) === false) {
|
if (move_uploaded_file($tmp_name, $file_path) === false) {
|
||||||
$msg['error'] = "上传文件失败。";
|
$msg['error'] = "Failed.Please re-try";
|
||||||
}
|
}
|
||||||
//数据库最终存储的文件
|
//数据库最终存储的文件
|
||||||
$dbsave .= $new_file_name;
|
$dbsave .= $new_file_name;
|
||||||
|
|
Loading…
Reference in New Issue