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 153153 }
154154
155155 $ 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 );
167158
168159 $ globalFile = [];
169160 $ globalFile ['files ' ] = $ file ;
Original file line number Diff line number Diff line change 7979 }
8080
8181 $ 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 );
9584
9685 $ globalFile = [];
9786 $ globalFile ['files ' ] = $ file ;
Original file line number Diff line number Diff line change 120120 }
121121
122122 $ 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 );
131125
132126 $ globalFile = [];
133127 $ globalFile ['files ' ] = $ file ;
Original file line number Diff line number Diff line change @@ -2255,3 +2255,20 @@ function getFileUploadSizeLimitForTeacher()
22552255
22562256 return $ size ;
22572257}
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