File tree Expand file tree Collapse file tree 4 files changed +23
-32
lines changed Expand file tree Collapse file tree 4 files changed +23
-32
lines changed Original file line number Diff line number Diff line change 153
153
}
154
154
155
155
$ resultList = [];
156
- foreach ($ fileList as $ file ) {
157
- if (isset ($ _REQUEST ['chunkAction ' ]) && 'done ' === $ _REQUEST ['chunkAction ' ]) {
158
- // to rename and move the finished file
159
- $ tmpFile = disable_dangerous_file (
160
- api_replace_dangerous_char ($ file ['name ' ])
161
- );
162
- $ chunkedFile = api_get_path (SYS_ARCHIVE_PATH ).$ tmpFile ;
163
- $ file ['tmp_name ' ] = $ chunkedFile ;
164
- $ file ['size ' ] = filesize ($ chunkedFile );
165
- $ file ['copy_file ' ] = true ;
166
- }
156
+ foreach ($ fileList as $ fileInfo ) {
157
+ $ file = processChunkedFile ($ fileInfo );
167
158
168
159
$ globalFile = [];
169
160
$ globalFile ['files ' ] = $ file ;
Original file line number Diff line number Diff line change 79
79
}
80
80
81
81
$ resultList = [];
82
- foreach ($ fileList as $ file ) {
83
- if (isset ($ _REQUEST ['chunkAction ' ]) && 'done ' === $ _REQUEST ['chunkAction ' ]) {
84
- // to rename and move the finished file
85
- $ tmpFile = disable_dangerous_file (
86
- api_replace_dangerous_char ($ file ['name ' ])
87
- );
88
-
89
- // to rename and move the finished file
90
- $ chunkedFile = api_get_path (SYS_ARCHIVE_PATH ).$ tmpFile ;
91
- $ file ['tmp_name ' ] = $ chunkedFile ;
92
- $ file ['size ' ] = filesize ($ chunkedFile );
93
- $ file ['copy_file ' ] = true ;
94
- }
82
+ foreach ($ fileList as $ fileInfo ) {
83
+ $ file = processChunkedFile ($ fileInfo );
95
84
96
85
$ globalFile = [];
97
86
$ globalFile ['files ' ] = $ file ;
Original file line number Diff line number Diff line change 120
120
}
121
121
122
122
$ resultList = [];
123
- foreach ($ fileList as $ file ) {
124
- if (isset ($ _REQUEST ['chunkAction ' ]) && 'done ' === $ _REQUEST ['chunkAction ' ]) {
125
- // to rename and move the finished file
126
- $ chunkedFile = api_get_path (SYS_ARCHIVE_PATH ).$ file ['name ' ];
127
- $ file ['tmp_name ' ] = $ chunkedFile ;
128
- $ file ['size ' ] = filesize ($ chunkedFile );
129
- $ file ['copy_file ' ] = true ;
130
- }
123
+ foreach ($ fileList as $ fileInfo ) {
124
+ $ file = processChunkedFile ($ fileInfo );
131
125
132
126
$ globalFile = [];
133
127
$ globalFile ['files ' ] = $ file ;
Original file line number Diff line number Diff line change @@ -2255,3 +2255,20 @@ function getFileUploadSizeLimitForTeacher()
2255
2255
2256
2256
return $ size ;
2257
2257
}
2258
+
2259
+ function processChunkedFile (array $ file ): array
2260
+ {
2261
+ if (isset ($ _REQUEST ['chunkAction ' ]) && 'done ' === $ _REQUEST ['chunkAction ' ]) {
2262
+ // to rename and move the finished file
2263
+ $ tmpFile = disable_dangerous_file (
2264
+ api_replace_dangerous_char ($ file ['name ' ])
2265
+ );
2266
+
2267
+ $ chunkedFile = api_get_path (SYS_ARCHIVE_PATH ) . $ tmpFile ;
2268
+ $ file ['tmp_name ' ] = $ chunkedFile ;
2269
+ $ file ['size ' ] = filesize ($ chunkedFile );
2270
+ $ file ['copy_file ' ] = true ;
2271
+ }
2272
+
2273
+ return $ file ;
2274
+ }
You can’t perform that action at this time.
0 commit comments