This repository was archived by the owner on Nov 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload_form.html
More file actions
executable file
·90 lines (82 loc) · 2.86 KB
/
upload_form.html
File metadata and controls
executable file
·90 lines (82 loc) · 2.86 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Codejune WebStorage Upload Form</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex, nofollow" />
<meta http-equiv="expires" content="mon, 06 jan 1990 00:00:01 GMT" />
<LINK REL="SHORTCUT ICON" HREF="/$skin/images/startup.png?action=SkinFile">
<LINK REL="SHORTCUT ICON" HREF="/$skin/images/startup.ico?action=SkinFile">
</head>
<body bgcolor="#FFFFFF" style='margin:0'>
<div style='margin:0px; font-size:10pt;'>
<form method="post" name="uploadForm" enctype="multipart/form-data">
<input type="file" name="uploadfile" size="60" class="text"/>
<input type="button" name="addfile" value="Add File" class="button" onClick='onAddFile();' />
<br /><input type="submit" value="Upload" class="button" onClick='return onUpload();' />
</form>
</div>
<script language="JavaScript" type="text/javascript">
///////////////////////////
// http://kldp.net/snippet/detail.php?type=snippet&id=43
String.prototype.trim = function()
{
var pattern = !arguments[0] ?
/^\s+|\s+$/g :
new RegExp('^['+arguments[0]+']+|['+arguments[0]+']+$', 'g');
return this.replace(pattern, '');
}
// 초기화
var uniqueKey = '[' + Math.random() + ']';
var loc = "" + document.location;
var urlPath = loc.substr(loc.indexOf("#")+1)
document.uploadForm.action = urlPath + "?action=Upload&key="+uniqueKey;
// 업로드 버튼이 눌렸을 때
function onUpload()
{
if(document.uploadForm.uploadfile.length)
{
for( var i = 0; i < document.uploadForm.uploadfile.length; ++i )
{
var localPath = document.uploadForm.uploadfile.item(i).value;
if( localPath.trim() != "" )
{
var pattern = new RegExp('.*[\\\\/]', 'g');
var filename = localPath.replace(pattern, '');
parent.onBeginUpload(filename, uniqueKey);
return true;
}
}
alert("업로드할 파일을 선택해 주십시오");
return false;
}
else
{
var localPath = document.uploadForm.uploadfile.value;
if( localPath.trim() != "" )
{
var pattern = new RegExp('.*[\\\\/]', 'g');
var filename = localPath.replace(pattern, '');
parent.onBeginUpload(filename, uniqueKey);
return true;
}
else
{
alert("업로드할 파일을 선택해 주십시오");
return false;
}
}
}
// 파일 추가 버튼이 눌렸을 때
function onAddFile()
{
var newEntry = document.createElement('span');
newEntry.innerHTML='<br /><input type="file" name="uploadfile" size="60" class="text" />';
var frm = document.uploadForm;
frm.insertBefore(newEntry, frm.addfile);
}
</script>
</body>
</html>