Skip to content

Commit

Permalink
粘贴上传文件名改为时间戳 Closed #314
Browse files Browse the repository at this point in the history
  • Loading branch information
0xxb committed Mar 17, 2022
1 parent 2511fd6 commit f1af71d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions resources/views/components/upload.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,17 @@
formData: (form) => {
return [{name: 'strategy_id', value: $('#strategy-selected').data('id')}];
},
paste: (e, data) => {
let files = [];
$.each(data.files, function (index, file) {
let name = new Date().getTime().toString();
files[index] = new File([file], name + "." + file.name.substr(file.name.lastIndexOf('.') + 1), {
type: file.type,
lastModified: file.lastModified,
});
});
data.files = files;
},
add: (e, data) => { // Return true to continue adding, otherwise terminate
let file = data.files[0];
let ext = file.name.substr(file.name.lastIndexOf('.') + 1);
Expand Down

0 comments on commit f1af71d

Please sign in to comment.