加入avif支持,修正date()函数出错
This commit is contained in:
parent
fc53a73ecc
commit
cfa8f0a48b
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
o/*
|
@ -23,7 +23,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) {
|
|||||||
$file_tmp = $_FILES['file']['tmp_name'];
|
$file_tmp = $_FILES['file']['tmp_name'];
|
||||||
$error = $_FILES['file']['error'];
|
$error = $_FILES['file']['error'];
|
||||||
|
|
||||||
// 获取当前年月
|
// 获取当前年月,为防止报错,先设置时区
|
||||||
|
date_default_timezone_set('Asia/Shanghai');
|
||||||
$year_month = date('Y/m');
|
$year_month = date('Y/m');
|
||||||
$upload_dir = $base_upload_dir . $year_month;
|
$upload_dir = $base_upload_dir . $year_month;
|
||||||
|
|
||||||
@ -223,7 +224,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) {
|
|||||||
<form id="uploadForm" enctype="multipart/form-data">
|
<form id="uploadForm" enctype="multipart/form-data">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="files" class="form-label"></label>
|
<label for="files" class="form-label"></label>
|
||||||
<input type="file" class="form-control" id="files" name="files[]" multiple accept="image/jpeg, image/png, image/gif, image/webp, image/bmp, image/svg+xml" required>
|
<input type="file" class="form-control" id="files" name="files[]" multiple accept="image/jpeg, image/png, image/gif, image/webp, image/avif, image/bmp, image/svg+xml" required>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary w-100" style="font-weight: bold;">开始上传</button>
|
<button type="submit" class="btn btn-primary w-100" style="font-weight: bold;">开始上传</button>
|
||||||
</form>
|
</form>
|
||||||
@ -238,7 +239,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) {
|
|||||||
<button class="btn btn-success" id="copyAllBtn">复制所有链接</button>
|
<button class="btn btn-success" id="copyAllBtn">复制所有链接</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h6 id="formatHint" class="card-title text-center">支持格式: JPEG, PNG, GIF, WEBP, BMP, SVG</h6>
|
<h6 id="formatHint" class="card-title text-center">支持格式: JPEG, PNG, GIF, WEBP, AVIF, BMP, SVG</h6>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -274,7 +275,7 @@ $(document).ready(function () {
|
|||||||
clearOutput();
|
clearOutput();
|
||||||
var files = this.files;
|
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));
|
var validFiles = Array.from(files).filter(file => validFormats.includes(file.type));
|
||||||
|
|
||||||
if (validFiles.length === 0) {
|
if (validFiles.length === 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user