Skip to content

Commit 05568fa

Browse files
committed
fix: laravel 大文件切片上传扩展
1 parent 750cc44 commit 05568fa

File tree

12 files changed

+737
-1
lines changed

12 files changed

+737
-1
lines changed

laravel/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"type": "project",
77
"require": {
88
"php": "^7.0",
9+
"auroralzdf/big-file-upload": "^2.0",
910
"baijunyao/laravel-scout-elasticsearch": "^2.1",
1011
"barryvdh/laravel-cors": "^0.11.2",
1112
"fideloper/proxy": "^3.0",

laravel/composer.lock

Lines changed: 40 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

laravel/config/bigfile.php

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
return [
4+
/*
5+
|------------------------
6+
| 文件每次切片尺寸
7+
|------------------------
8+
*/
9+
'chunk_size' => 1024 * 1024 * 2,
10+
11+
12+
/*
13+
|------------------------
14+
| 允许上传文件最大尺寸
15+
|------------------------
16+
*/
17+
'max_size' => 1024 * 1024 * 1024,
18+
19+
20+
/*
21+
|------------------------
22+
| 文件保存路径
23+
|------------------------
24+
*/
25+
'save_path' => 'upload/'.date('Y').'/'.date('m').'/',
26+
27+
28+
/*
29+
|------------------------
30+
| 文件切片缓存路径
31+
|------------------------
32+
*/
33+
'tmp_path' => storage_path('app/public/tmp'),
34+
35+
36+
/*
37+
|------------------------
38+
| 允许上传文件类型
39+
|------------------------
40+
*/
41+
'allow_type' => ['jpg', 'jpeg', 'gif', 'png', 'mp4', 'mp3', 'zip', 'apk', 'pdf', 'rar'],
42+
43+
44+
/*
45+
|------------------------
46+
| 切片文件是否随机命名
47+
|------------------------
48+
*/
49+
'rand_name' => true,
50+
51+
52+
/*
53+
|------------------------
54+
| 是否删除临时文件
55+
|------------------------
56+
*/
57+
'remove_tmp_file' => true,
58+
];
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.webuploader-container {
2+
position: relative;
3+
}
4+
.webuploader-element-invisible {
5+
position: absolute !important;
6+
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
7+
clip: rect(1px,1px,1px,1px);
8+
}
9+
.webuploader-pick {
10+
position: relative;
11+
display: inline-block;
12+
cursor: pointer;
13+
background: #00b7ee;
14+
padding: 10px 15px;
15+
color: #fff;
16+
text-align: center;
17+
border-radius: 3px;
18+
overflow: hidden;
19+
}
20+
.webuploader-pick-hover {
21+
background: #00a2d4;
22+
}
23+
24+
.webuploader-pick-disable {
25+
opacity: 0.6;
26+
pointer-events:none;
27+
}
28+
140 KB
Binary file not shown.

0 commit comments

Comments
 (0)