From cfa8f0a48bd19cf958667bc86a95b7d0f6be800b Mon Sep 17 00:00:00 2001 From: sunson Date: Sat, 30 Nov 2024 18:56:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5avif=E6=94=AF=E6=8C=81?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=AD=A3date()=E5=87=BD=E6=95=B0=E5=87=BA?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ index.php | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..71c62bf --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +o/* diff --git a/index.php b/index.php index 8455a92..7109126 100644 --- a/index.php +++ b/index.php @@ -23,7 +23,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) { $file_tmp = $_FILES['file']['tmp_name']; $error = $_FILES['file']['error']; - // 获取当前年月 + // 获取当前年月,为防止报错,先设置时区 + date_default_timezone_set('Asia/Shanghai'); $year_month = date('Y/m'); $upload_dir = $base_upload_dir . $year_month; @@ -223,7 +224,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) {
- +
@@ -238,7 +239,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) { -
支持格式: JPEG, PNG, GIF, WEBP, BMP, SVG
+
支持格式: JPEG, PNG, GIF, WEBP, AVIF, BMP, SVG
@@ -274,7 +275,7 @@ $(document).ready(function () { clearOutput(); var files = this.files; // 允许的文件类型 - var validFormats = ['image/jpeg', 'image/png', 'image/gif', 'image/webp', 'image/bmp', 'image/svg']; + var validFormats = ['image/jpeg', 'image/png', 'image/gif', 'image/webp', 'image/avif', 'image/bmp', 'image/svg']; var validFiles = Array.from(files).filter(file => validFormats.includes(file.type)); if (validFiles.length === 0) {