// iplanet 연동으로 인해 was까지 딜레이로 uploadMonitor Sync용 딜레이 연산
function filesize1(){
//alert(uploadLen);
var fileObj = null;
var len = "";
fileObj = document.getElementById("file1");
if(navigator.userAgent.indexOf('MSIE') < 0){
// IE 아닐경우
if(typeof FileReader !=="undefined"){
len = fileObj.files[0].size;
}
} else if(navigator.userAgent.indexOf('MSIE') > 0){
// IE
if(navigator.appVersion.indexOf("MSIE 6.") > 0){
//IE6
var img = new Image();
img.dynsrc = fileObj.value;
len = img.fileSize;
} else {
// IE7,9
var fso=new ActiveXObject('Scripting.FileSystemObject');
var f =fso.GetFile(fileObj.value);
//alert(f.Size);
//alert(f.DateCreated);
len = f.size;
f = null;
fso = null;
}
}
// 최대 50MB len은 MB로 계산
len = len/(1024*1024);
var strLen = len+"";
uploadLen = strLen.substring(0 , strLen.indexOf("."));
if(uploadLen == 0 || uploadLen < 5 ){
msec = 3000;
} else {
msec = uploadLen * 600;
}
alert(msec);
}
function getSize(){
var str = document.all;
alert(str.gimg.fileSize);
}
var uploadLen = "0";
var msec = 3000;
// 파일 업로드 상태 바를 보여준다.
function upload() {
startProgress2(msec);
document.uploadFrm.submit();
}
$(document).ready(function() {
if("<%=uploadType%>" == "template") {
$("#attention").each(function() {
$(this).show();
});
}
});
var timer;
function refreshProgress() {
UploadMonitor.getUploadInfo(updateProgress);
}
function updateProgress(uploadInfo) {
if (uploadInfo.inProgress) {
clearInterval(timer);
timer = 0;
document.getElementById('uploadbutton').disabled = true;
document.getElementById('file1').disabled = true;
var fileIndex = uploadInfo.fileIndex;
var progressPercent = Math.ceil((uploadInfo.bytesRead / uploadInfo.totalSize) * 100);
document.getElementById('progressBarText').innerHTML = 'upload in progress: ' + progressPercent + '%, transfered ' + uploadInfo.bytesRead + ' of ' + uploadInfo.totalSize + ' bytes';
widthMultiplier = document.getElementById('progressBarBox').clientWidth / 100;
document.getElementById('progressBarBoxContent').style.width = parseInt(progressPercent * widthMultiplier) + 'px';
window.setTimeout('refreshProgress()', 500);
}
else {
document.getElementById('uploadbutton').disabled = false;
document.getElementById('file1').disabled = false;
}
return true;
}
function startProgress() {
document.getElementById('progressBarBoxContent').style.width = 0 + 'px';
document.getElementById('progressBarText').innerHTML = 'upload in progress: 0%';
document.getElementById('uploadbutton').disabled = true;
window.setTimeout("refreshProgress()", 1500);
document.getElementById('progressBar').style.display = 'block';
return true;
}
function startProgress2(value) {
var msec = value;
document.getElementById('progressBarBoxContent').style.width = 0 + 'px';
//document.getElementById('progressBarText').innerHTML = 'upload in progress: 0%';
document.getElementById('progressBarText').innerHTML = 'upload in progress: 0%, initialization, wait a minute';
document.getElementById('uploadbutton').disabled = true;
//window.setTimeout("refreshProgress()", msec);
timer = setInterval("refreshProgress()",3000);
document.getElementById('progressBar').style.display = 'block';
return true;
}
'script' 카테고리의 다른 글
document.implemention.hasFeature('Core') (0) | 2013.04.19 |
---|---|
decodeXSS (0) | 2012.10.04 |
정규식 : 특정단어 제외 (0) | 2012.03.01 |
undefined, null, typeof (0) | 2012.01.11 |
offsetHeight, clientHeight, scrollHeight (0) | 2011.09.19 |