<?php
/****************************************/
/*                                      */
/*  百信卡盟平台联系QQ:84945491         */
/*  淘宝店 http://shop70674652.taobao.com  */
/*  百信卡盟 http://www.caipiaobus.com  */
/*                                      */
/****************************************/

echo "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\"/>\r\n";
echo "<s";
echo "tyle type=\"text/css\">\r\nbody {\r\nBACKGROUND:#fff;\r\nMARGIN:0;\r\nFONT:normal 12px 宋体;\r\n}\r\n\r\ninput {\r\nborder:1px solid #ccc;\r\nheight:22px;\r\nfont-size:12px;\r\ncolor:#252728;\r\npadding:3px 0px 0px 6px;\r\nBACKGROUND:#fff;\r\n}\r\n#preview_size_fake{\r\nfilter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=image);\r\nvisibility:hidden;\r\n}\r\n</style>\r\n</head>\r\n<body>\r\n";
echo "<s";
echo "cript type=\"text/javascript\">\r\n  function BuildBaseUrl( command )\r\n  {\r\n  \tIsFlash();\r\n    var sUrl =\r\n      document.getElementById('cmbConnector').value +\r\n      '?Command=' + command +\r\n      '&Type=' + document.getElementById('cmbType').value +\r\n      '&CurrentFolder=' + encodeURIComponent(document.getElementById('txtFolder').value) ;\r\n    \r\n    return sUrl ;\r\n  }\r\n  \r\n  function IsFlash()\r\n  ";
echo "{\r\n  \tobj = document.getElementById(\"txtFileUpload\");\r\n  \tif( obj.value.match( /.swf/i ) ){\r\n        document.getElementById(\"cmbType\").value = \"Flash\";\r\n        return true;\r\n    }\r\n    else\r\n  \t{\r\n  \t\treturn false;\r\n  \t}\r\n  } \r\n  \r\n  function SetFrameUrl( url )\r\n  {\r\n    document.getElementById('eRunningFrame').src = url ;\r\n  \r\n    document.getElementById('eUrl').innerHTML = url ;\r\n  }\r\n  \r\n  fu";
echo "nction GetFolders()\r\n  {\r\n    SetFrameUrl( BuildBaseUrl( 'GetFolders' ) ) ;\r\n    return false ;\r\n  }\r\n  \r\n  function GetFoldersAndFiles()\r\n  {\r\n    SetFrameUrl( BuildBaseUrl( 'GetFoldersAndFiles' ) ) ;\r\n    return false ;\r\n  }\r\n  \r\n  function CreateFolder()\r\n  {\r\n    var sFolder = prompt( 'Type the folder name:', 'Test Folder' ) ;\r\n  \r\n    if ( ! sFolder )\r\n      return false ;\r\n  \r\n    var sUrl =";
echo " BuildBaseUrl( 'CreateFolder' ) ;\r\n    sUrl += '&NewFolderName=' + encodeURIComponent( sFolder ) ;\r\n  \r\n    SetFrameUrl( sUrl ) ;\r\n    return false ;\r\n  }\r\n  \r\n  function OnUploadCompleted( errorNumber, fileName )\r\n  {\r\n    switch ( errorNumber )\r\n    {\r\n      case 0 :\r\n        SetFile(fileName);\r\n        //alert( 'File uploaded with no errors' ) ;\r\n        break ;\r\n      case 201 :\r\n        GetFo";
echo "ldersAndFiles() ;\r\n        SetFile(fileName);\r\n        //alert( 'A file with the same name is already available. The uploaded file has been renamed to \"' + fileName + '\"' ) ;\r\n        break ;\r\n      case 202 :\r\n        alert( 'Invalid file' ) ;\r\n        break ;\r\n      default :\r\n        alert( 'Error on file upload. Error number: ' + errorNumber ) ;\r\n        break ;\r\n    }\r\n  }\r\n  \r\n  this.frames.";
echo "frmUpload = this ;\r\n  \r\n  function SetAction()\r\n  {\r\n    var sUrl = BuildBaseUrl( 'FileUpload' ) ;\r\n    document.getElementById('eUrl').innerHTML = sUrl ;\r\n    document.getElementById('frmUpload').action = sUrl ;\r\n  }\r\n  \r\n  function ShowImg(obj, imgid)\r\n  {\r\n    if( !obj.value.match( /.jpg|.gif|.png|.bmp|.swf/i ) ){\r\n        alert('图片格式无效！');\r\n        return false;\r\n    }\r\n    \r\n    if( ob";
echo "j.files &&  obj.files[0] )\r\n    {\r\n      imgpath = obj.files[0].getAsDataURL();\r\n      window.parent.document.getElementById(imgid).innerHTML = \"<img src='\" + imgpath + \"' onload='";
echo $vd['fun'];
echo "(this)'/>\";\r\n    } \r\n    else if(!window.XMLHttpRequest) \r\n    {\r\n      imgpath = obj.value;\r\n      window.parent.document.getElementById(imgid).innerHTML = \"<img src='\" + imgpath + \"' onload='";
echo $vd['fun'];
echo "(this)'/>\";\r\n    } \r\n    else \r\n    {\r\n      imgpath = getValueIE8(obj);\r\n      objPreviewSizeFake = document.getElementById('preview_size_fake' );\r\n      window.parent.document.getElementById(imgid).filters.item(\r\n            'DXImageTransform.Microsoft.AlphaImageLoader').src  = imgpath;\r\n      objPreviewSizeFake.filters.item(\r\n            'DXImageTransform.Microsoft.AlphaImageLoader').src = imgp";
echo "ath;\r\n\r\n      autoSizePreview( window.parent.document.getElementById(imgid),\r\n            objPreviewSizeFake.offsetWidth, objPreviewSizeFake.offsetHeight );\r\n    }\r\n  }\r\n  \r\n  function getValueIE8(obj)\r\n  {\r\n    obj.select();\r\n    return document.selection.createRange().text;\r\n  }\r\n  \r\n  function autoSizePreview( objPre, originalWidth, originalHeight )\r\n  {\r\n    objPre.style.width = originalWidth ";
echo "+ 'px';\r\n    objPre.style.height = originalHeight + 'px';\r\n    objPre.style.marginTop = 0 + 'px';\r\n    objPre.style.marginLeft = 0 + 'px';\r\n  }\r\n\r\n  function clacImgZoomParam( maxWidth, maxHeight, width, height )\r\n  {\r\n    var param = { width:width, height:height, top:0, left:0 };\r\n\r\n    if( width>maxWidth || height>maxHeight )\r\n    {\r\n      rateWidth = width / maxWidth;\r\n      rateHeight = height";
echo " / maxHeight;\r\n\r\n      if( rateWidth > rateHeight )\r\n      {\r\n        param.width =  maxWidth;\r\n        param.height = height / rateWidth;\r\n      }else{\r\n        param.width = width / rateHeight;\r\n        param.height = maxHeight;\r\n      }\r\n    }\r\n\r\n    param.left = (maxWidth - param.width) / 2;\r\n    param.top = (maxHeight - param.height) / 2;\r\n\r\n    return param;\r\n  }\r\n\r\n  \r\n  function SetFile(fn";
echo "ame)\r\n  {\r\n    //get the name\r\n    document.getElementById(\"uploadresult\").innerHTML = \"上传成功!路径：\" + fname;\r\n    var temp = fname.split('/');\r\n    window.parent.document.getElementById(\"";
echo $vd['inputid'];
echo "\").value = temp[temp.length-1];\r\n  }\r\n</script>\r\n<form id=\"frmUpload\" action=\"\" target=\"eRunningFrame\" method=\"post\" enctype=\"multipart/form-data\">\r\n  <input id=\"txtFolder\" type=\"hidden\" value=\"";
echo $vd['dirname'];
echo "\" name=\"txtFolder\" />\r\n  <input id=\"cmbType\"   type=\"hidden\" value=\"Image\" name=\"cmbType\" />\r\n  <input id=\"txtFileUpload\" type=\"file\" name=\"NewFile\" onchange=\"ShowImg(this, ";
echo $vd['imgid'];
echo ")\"/>\r\n  <input type=\"submit\" value=\"上传\" onclick=\"SetAction();\"/>\r\n  <font color=\"#FF0000\">";
echo "<s";
echo "pan id=\"uploadresult\">* (请选择要上传的图片,然后点击上传按钮)</span></font>\r\n</form>\r\n<img id=\"preview_size_fake\"/>\r\n";
echo "<s";
echo "pan id=\"eUrl\" style=\"display:none\"></span>\r\n<iframe id=\"eRunningFrame\" src=\"javascript:void(0)\" name=\"eRunningFrame\" width=\"100%\" style=\"display:none\"></iframe>\r\n";
echo "<s";
echo "pan id=\"eUrl\" style=\"display:none\"></span>\r\n<input type=\"hidden\" id=\"cmbConnector\" name=\"cmbConnector\" value=\"";
echo $vd['connecter'];
echo "\" />\r\n</body>\r\n</html>\r\n";
?>
