TranFile.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. if(!defined('InEmpireCMS'))
  3. {
  4. exit();
  5. }
  6. ?>
  7. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  8. <html>
  9. <head>
  10. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  11. <title>上传附件</title>
  12. <link type="text/css" href="images/editorpage.css" rel=stylesheet>
  13. <script>
  14. function EcmsEditorReturnDoAction0(str){
  15. window.parent.EHEcmsEditorDoTranFile(str);
  16. self.location.href=self.location.href;
  17. }
  18. </script>
  19. <script type="text/javascript">
  20. function DoCheckTranFile(obj){
  21. var ctypes,actypes,cfiletype,sfile,sfocus;
  22. if(obj.file.value=='')
  23. {
  24. alert('请选择要上传的文件');
  25. obj.file.focus();
  26. return false;
  27. }
  28. sfile=obj.file.value;
  29. sfocus=0;
  30. return true;
  31. }
  32. function ToGetFiletype(sfile){
  33. var filetype,s;
  34. s=sfile.lastIndexOf(".");
  35. filetype=sfile.substring(s+1).toLowerCase();
  36. return '.'+filetype;
  37. }
  38. //返回编号
  39. function ExpStr(str,exp){
  40. var pos,len,ext;
  41. pos=str.lastIndexOf(exp)+1;
  42. len=str.length;
  43. ext=str.substring(pos,len);
  44. return ext;
  45. }
  46. function GetFname(str){
  47. var filename,exp;
  48. if(str.indexOf("\\")>=0)
  49. {
  50. exp="\\";
  51. }
  52. else
  53. {
  54. exp="/";
  55. }
  56. filename=ExpStr(str,exp);
  57. return filename;
  58. }
  59. function ReturnFileNo(obj){
  60. var filename,str,exp;
  61. if(obj.no.value!='')
  62. {
  63. return '';
  64. }
  65. str=obj.file.value;
  66. filename=GetFname(str);
  67. obj.no.value=filename;
  68. }
  69. //预览
  70. function echoViewFile(obj,doshow){
  71. var imgstr,filetype,fn,filename,furl,sizestr;
  72. if(obj.inserturl.value=='')
  73. {
  74. return '';
  75. }
  76. furl=obj.inserturl.value;
  77. filetype=ToGetFiletype(furl);
  78. filename=GetFname(furl);
  79. if(obj.fname.value=='')
  80. {
  81. fn=filename;
  82. }
  83. else
  84. {
  85. fn=obj.fname.value;
  86. }
  87. sizestr='';
  88. if(obj.filesize.value!='')
  89. {
  90. sizestr="&nbsp;("+obj.filesize.value+")";
  91. }
  92. imgstr="<div style='padding:6px'><fieldset><legend>"+fn+"</legend><table cellpadding=0 cellspacing=0 border=0><tr><td><img src='<?=$public_r[newsurl]?>e/data/images/downfile.jpg' alt='文件类型: "+filetype+"' border=0 style='vertical-align:baseline'></td><td> <a href='"+furl+"' title='"+fn+"' target='_blank'>"+filename+"</a>"+sizestr+"</td></tr></table></fieldset></div>";
  93. if(doshow==0)
  94. {
  95. document.getElementById("ViewFile").innerHTML=imgstr;
  96. return '';
  97. }
  98. }
  99. </script>
  100. </head>
  101. <body scroll="no" style="OVERFLOW: hidden" topmargin="0">
  102. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" id="tranpictb">
  103. <form id="TranFileFormT" name="TranFileFormT" method="post" target="eeditoruploadfile<?=$ecms_topager['InstanceId']?>" enctype="multipart/form-data" action="../../../DoInfo/ecms.php" onsubmit="return DoCheckTranFile(TranFileFormT);">
  104. <input type=hidden name=classid value="<?=$ecms_topager['classid']?>">
  105. <input type=hidden name=filepass value="<?=$ecms_topager['filepass']?>">
  106. <input type=hidden name=infoid value="<?=$ecms_topager['infoid']?>">
  107. <input type=hidden name=enews value="MEditorTranFile">
  108. <input type=hidden name=type value="0">
  109. <input type=hidden name=doing value="0">
  110. <input type=hidden name=tranfrom value="1">
  111. <input type=hidden name=InstanceName value="<?=$ecms_topager['InstanceName']?>">
  112. <input type=hidden name=InstanceId value="<?=$ecms_topager['InstanceId']?>">
  113. <input type=hidden name=doecmspage id=doecmspage value="<?=$doecmspage?>">
  114. <tr>
  115. <td><strong>本地上传</strong><br>
  116. <input type="file" name="file" id="file" style="width: 100%"> </td>
  117. </tr>
  118. <tr>
  119. <td height="30"> <input type="submit" name="Submit2" value="上 传"> </td>
  120. </tr>
  121. </form>
  122. </table>
  123. <iframe name="eeditoruploadfile<?=$ecms_topager['InstanceId']?>" id="eeditoruploadfile<?=$ecms_topager['InstanceId']?>" style="display:none" src="images/blank.html"></iframe>
  124. </body>
  125. </html>