Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
cee9293f
Commit
cee9293f
authored
Dec 11, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化上传文件随机名生成
parent
a9dd4729
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
UploadFileService.php
application/api_broker/service/UploadFileService.php
+3
-3
No files found.
application/api_broker/service/UploadFileService.php
View file @
cee9293f
...
@@ -93,11 +93,11 @@ class UploadFileService
...
@@ -93,11 +93,11 @@ class UploadFileService
}
}
$date
=
date
(
'Ymd'
);
$date
=
date
(
'Ymd'
);
$path
.=
$date
;
$path
.=
$date
;
$name_str
=
date
(
'YmdHis'
)
.
mt_rand
(
10
,
1000
)
;
$name_str
=
date
(
'YmdHis'
);
if
(
is_array
(
$_upload_file
[
'tmp_name'
]))
{
if
(
is_array
(
$_upload_file
[
'tmp_name'
]))
{
foreach
(
$_upload_file
[
'tmp_name'
]
as
$k
=>
$v
)
{
foreach
(
$_upload_file
[
'tmp_name'
]
as
$k
=>
$v
)
{
$name_str
.=
$k
;
$name_str
.=
mt_rand
(
10
,
10000
)
;
$_file
=
new
File
(
$v
);
$_file
=
new
File
(
$v
);
$file_info
=
pathinfo
(
$_upload_file
[
'name'
][
$k
]);
$file_info
=
pathinfo
(
$_upload_file
[
'name'
][
$k
]);
$info
=
$_file
->
validate
(
$valid_date
)
->
move
(
$path
,
$name_str
.
'.'
.
$file_info
[
'extension'
]);
$info
=
$_file
->
validate
(
$valid_date
)
->
move
(
$path
,
$name_str
.
'.'
.
$file_info
[
'extension'
]);
...
@@ -115,7 +115,7 @@ class UploadFileService
...
@@ -115,7 +115,7 @@ class UploadFileService
}
}
}
else
{
}
else
{
$name_str
.=
mt_rand
(
10
,
1000
);
$_file
=
new
File
(
$_upload_file
[
'tmp_name'
]);
$_file
=
new
File
(
$_upload_file
[
'tmp_name'
]);
$file_info
=
pathinfo
(
$_upload_file
[
'name'
]);
$file_info
=
pathinfo
(
$_upload_file
[
'name'
]);
$info
=
$_file
->
validate
(
$valid_date
)
->
move
(
$path
,
$name_str
.
'.'
.
$file_info
[
'extension'
]);
$info
=
$_file
->
validate
(
$valid_date
)
->
move
(
$path
,
$name_str
.
'.'
.
$file_info
[
'extension'
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment