-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
无法上传图片 2024年9月6日18点28分 #178
Comments
me too |
可能tg封了 |
把接口修一修就可以继续用了。 可以自己部署一个兼容程序:<?php
$targetDir = "file/";
$targetFile = $targetDir . basename($_FILES["file"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($targetFile, PATHINFO_EXTENSION));
if (isset($_FILES['file'])) {
$check = getimagesize($_FILES["file"]["tmp_name"]);
if ($check !== false) {
//echo "Log: File-mine" . $check["mime"] . ".";
$uploadOk = 1;
} else {
//echo "Log: mine err";
$uploadOk = 0;
}
}
if (file_exists($targetFile)) {
//echo "Log: file exists.";
$uploadOk = 0;
}
if ($_FILES["file"]["size"] > 5000000) { // 限制为5M
//echo "Log: file too big.";
$uploadOk = 0;
}
if (!in_array($imageFileType, ["jpg", "png", "jpeg", "gif"])) {
echo "Log:Only upload: JPG, JPEG, PNG & GIF file.";
$uploadOk = 0;
}
if ($uploadOk == 0) {
echo '{"msg":"upload fail."}';
} else {
if (move_uploaded_file($_FILES["file"]["tmp_name"], $targetFile)) {
$responsex = [["src" => $targetFile]];
echo json_encode($responsex);
} else {
echo '{"msg":"500 ERROR."}';
}
}
?> 把上面程序任意丢在php运行环境中,配置好伪静态 /upload - > /upload.php,配置好同目录文件夹 要自用的话,可以配合IP白名单+反代鉴权。 程序自测,有bug自修。改接口地址就能用了 |
我也是 |
+1 |
请查看issue:#180 |
就这么简单? |
How to deploy a compatible program of your own? Are there any reference examples? Do I still need to buy a server? |
Any PHP environment can be deployed, including free php host, virtual php host, vps, etc. |
B站搜索“Telegraph图床(Unknown Error)完美兼容老版本”有解决视频 |
确实不错,我试试 |
The text was updated successfully, but these errors were encountered: