Php 未在新服务器上引发错误消息
这些错误会在旧服务器上抛出…但不会在新服务器上抛出。它只是将用户返回到上载页面。它仍然像它应该的那样工作…只是没有 错误消息 你知道这是什么原因吗Php 未在新服务器上引发错误消息,php,upload,Php,Upload,这些错误会在旧服务器上抛出…但不会在新服务器上抛出。它只是将用户返回到上载页面。它仍然像它应该的那样工作…只是没有 错误消息 你知道这是什么原因吗 Array ( [0] => Oops. Your photo's size is 1.76 mb. Max allowed is 1 mb. ) Array ( [0] => Sorry, only jpeg/jpg, gif, and png extensions allowed. ) 测试文件大小:1.76 mb 代码如下: Ol
Array ( [0] => Oops. Your photo's size is 1.76 mb. Max allowed is 1 mb. )
Array ( [0] => Sorry, only jpeg/jpg, gif, and png extensions allowed. )
测试文件大小:1.76 mb
代码如下:
Old server:
upload_max_filesize set to 20M
post_max_size set to 20M
New server:
upload_max_filesize set to 2M
post_max_size set to 2M
新服务器上启用了哪种类型的错误消息?将其设置为E-ALL并检查一次ENO错误消息…添加
ini\u集(“错误报告”,E-ALL)仍然没有错误消息。我得到了正确的消息抛出与旧服务器…与新服务器我得到了“成功”的消息时,上传相同的文件(1.76 mb)ok,它工作正常。我假设php.ini中的服务器端检查获得第一优先级,然后php检查……那么如果upload_max_filesize检查失败,那么php检查将不会输出?
<?php if(isset($_FILES['image'])){
$errors= array();
$file_name = $_FILES['image']['name'];
$file_size =$_FILES['image']['size'];
$file_tmp =$_FILES['image']['tmp_name'];
$file_type=$_FILES['image']['type'];
$file_ext=strtolower(end(explode('.',$_FILES['image']['name'])));
$file_name=strtolower($file_name);
$file_name = str_replace(' ', '', $file_name);
$random_digit=rand(0000000,9999999);
$file_name=$random_digit.$file_name;
$extensions = array("jpeg","jpg","gif","png");
if(in_array($file_ext,$extensions )=== false){
$errors[]= "Sorry, only jpeg/jpg, gif, and png extensions allowed.";
}
else if ($file_size > 1097152){
$file_size=$file_size/1048576;
$errors[]= "Oops. Your photo's size is ".round($file_size,2)." mb. Max allowed is 1 mb.";
}
else if (file_exists("images/" . $file_name))
{
echo $file_name . " already exists. ";
}
if(empty($errors)==true){
if(move_uploaded_file($file_tmp,"images/".$file_name)){
mysqli_query($connect,"UPDATE users SET image='$file_name'
WHERE id LIKE '$id'");
mysqli_close();
include "php_image_magician/1.1_resize_basic.php";
}
}else{
print_r($errors);
}
}
if(empty($errors)==true){
echo "Success";
}
?>