<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Upfile.aspx.cs" Inherits="Mvcb2b.admin.Upfile" %><%string webcode = Fun.Webcode; %>
<!doctype html>
<html>
<head>
<meta charset="<%=webcode%>">
<title>上传文件</title>
<style type="text/css">*{margin:0px;padding:0px;font-size:12px;} .progress{
 border: 1px solid blue;margin-left:auto;margin-right:auto;
 width:306px;
 height:16px;
 }.oneinfo{height:32px;}
#info,#info2{width:306px;margin-left:auto;margin-right:auto;display:none;line-height:16px;min-height:64px;height:auto!important;height:64px;text-align:left;}
#info2{display:none;}
.bar {
 background:green;
 height:16px;
 width:0%;
 }.clear{clear:both; height:0;font-size:0px;overflow:hidden;display:block;}</style>
 <script type="text/javascript">
     var savefile = "<%=SaveFile%>";
</script>
<script type="text/javascript" src="Comja/upfile.js"></script>
 <script type="text/javascript">
     function check() {
         if (document.form1.file2.value == "") {
             alert("上传文件不能为空");
             document.getElementById('info2').style.display = "none";
             document.getElementById('info2').innerHTML = "";
             return false;
         }
         if (IsHtml5() == true) {
             return false;
         }
         else {
             document.getElementById("ishtml5").value = "0";
         }

     }
 </script>
</head>

<body style="padding-top:30px;text-align:center">
<form id="form1" name="form1" method="post" enctype="multipart/form-data" onsubmit="return check();" action="<%=SaveFile%>">
<input type="hidden"  name="ishtml5" id="ishtml5" value="1">
<input type="file" name="file2"  id="file2" value="" style="width:232px;height:22px;"  multiple ><input style="margin-left:3px;width:73px;height:22px;" id="submit1"  type="submit" name="submit1" value="开始上传" >
<div id="info">
<!--<div class="oneinfo">
文件名：<span class="filename"></span> <span class="filesize"></span> （<span class="fileupinfo"></span>）
<div class="progress"><div class="bar"></div></div>
</div>-->
<div class="clear"></div>
</div>

<div id="info2">
</div><div style="display:none" id="upnumber">0</div>
</form>
<script type="text/javascript">
    var ismul = 1;
    // document.getElementsByTagName('input')[0].onchange = function() {
    document.getElementById('submit1').onclick = function () {
        var fd;
        var obj;
        var file;
        var files;
        try {
            if (ismul == 1) {
                // html5新增的对象,可以包装字符,二进制信息
                //obj = document.getElementsByTagName('input')[0];
                obj = document.getElementById("file2");
                var files = obj.files;
                document.getElementById('info').style.display = "block";
                var len = files.length;
                for (var i = 0; i < files.length; i++) {
                    fd = new FormData();
                    fd.append(obj.name + i, files[i]);
                    up(fd, files[i], len, i);
                }

            }
            else {
                var len = 1;
                fd = new FormData(); // html5新增的对象,可以包装字符,二进制信息
                // obj = document.getElementsByTagName('input')[0];
                obj = document.getElementById("file2");
                file = obj.files[0];
                fd.append(obj.name, file);
                up(fd, file, len, 0);
            }
        }
        catch (Error) {
            //alert(Error);
            document.getElementById('info2').style.display = "block";
            document.getElementById('info2').innerHTML = "<p style='padding-top:10px;text-align:center;'>您正在使用非HTML5浏览器上传图片……</p>";
        }
    }
</script>
</body>
</html>
