forked from webmin/webmin
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathupform.cgi
executable file
·54 lines (45 loc) · 1.38 KB
/
upform.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/local/bin/perl
# upform.cgi
# Display the upload form
$trust_unknown_referers = 1;
require './file-lib.pl';
$disallowed_buttons{'upload'} && &error($text{'ebutton'});
&ReadParse(undef, undef, 1);
&popup_header($text{'upload_title'});
$upid = time().$$;
$args = ($in{'extra'} ? $in{'extra'}."&" : "?")."id=$upid";
print &ui_form_start("upload.cgi$args", "form-data", undef,
&read_parse_mime_javascript($upid, [ "file" ]));
print &ui_table_start($text{'upload_title'}, "width=100%", 2);
print &ui_table_row($text{'upload_file'},
&ui_upload("file", 20));
print &ui_table_row($text{'upload_dir'},
&ui_textbox("dir", $in{'dir'}, 20)."\n".
&ui_submit($text{'upload_ok'}));
if ($dostounix == 1) {
# Do DOS conversion?
print &ui_table_row($text{'upload_conv'},
&ui_yesno_radio("dos", 0));
}
if ($unarchive == 1) {
# Unzip file?
print &ui_table_row($text{'upload_zip'},
&ui_radio("zip", int($config{'defzip'}),
[ [ 2, $text{'upload_yes'} ],
[ 1, $text{'yes'} ],
[ 0, $text{'no'} ] ]));
}
if ($running_as_root) {
# Upload as user
$user = $config{'defuser'} || "root";
if ($user eq "*") {
# Get from parent directory
local @st = stat(&unmake_chroot($in{'dir'}));
$user = getpwuid($st[4]);
}
print &ui_table_row($text{'upload_user'},
&ui_user_textbox("user", $user));
}
print &ui_table_end();
print &ui_form_end();
&popup_footer();