File tree 1 file changed +44
-0
lines changed
1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ $ header_prefix = 'file ' ;
3
+ $ upload_dir = 'upload ' ;
4
+ $ slots = 6 ;
5
+
6
+ if ($ _POST ){
7
+ for ($ i =0 ;$ i <=$ slots ;$ i ++){
8
+ $ key = $ header_prefix .$ i ;
9
+ if (array_key_exists ($ key ."_name " , $ _POST ) && array_key_exists ($ key ."_path " ,$ _POST )) {
10
+ $ tmp_name = $ _POST [$ key ."_path " ];
11
+ $ name = $ _POST [$ key ."_name " ];
12
+ $ newname = $ upload_dir ."/ " .$ name ;
13
+ if (rename ($ tmp_name , $ newname )) {
14
+ echo "Moved to $ upload_dir successfull<br/> \n" ;
15
+ } else {
16
+ echo "Failed to move file<br/> \n" ;
17
+ }
18
+ }else {
19
+ continue ;
20
+ }
21
+ }
22
+ }else {?>
23
+
24
+ <html>
25
+ <head>
26
+ <title>Test upload</title>
27
+ </head>
28
+ <body>
29
+ <h2>Select files to upload</h2>
30
+ <form name="upload" method="POST" enctype="multipart/form-data" action="/doupload">
31
+ <input type="file" name="file1"><br>
32
+ <input type="file" name="file2"><br>
33
+ <input type="file" name="file3"><br>
34
+ <input type="file" name="file4"><br>
35
+ <input type="file" name="file5"><br>
36
+ <input type="file" name="file6"><br>
37
+ <input type="submit" name="submit" value="Upload">
38
+ <input type="hidden" name="test" value="value">
39
+ </form>
40
+ </body>
41
+ </html>
42
+
43
+ <? }
44
+ ?>
You can’t perform that action at this time.
0 commit comments