TranImg.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 EcmsEditorReturnDoAction1(str){
  15. window.parent.EHEcmsEditorDoTranImg(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. ctypes="<?=$ecms_config['sets']['tranpicturetype']?>";
  23. if(obj.file.value=='')
  24. {
  25. alert('请选择要上传的图片');
  26. obj.file.focus();
  27. return false;
  28. }
  29. sfile=obj.file.value;
  30. sfocus=0;
  31. cfiletype=','+ToGetFiletype(sfile)+',';
  32. if(ctypes.indexOf(cfiletype)==-1)
  33. {
  34. alert('文件扩展名错误');
  35. obj.file.focus();
  36. return false;
  37. }
  38. return true;
  39. }
  40. function ToGetFiletype(sfile){
  41. var filetype,s;
  42. s=sfile.lastIndexOf(".");
  43. filetype=sfile.substring(s+1).toLowerCase();
  44. return '.'+filetype;
  45. }
  46. //返回编号
  47. function ExpStr(str,exp){
  48. var pos,len,ext;
  49. pos=str.lastIndexOf(exp)+1;
  50. len=str.length;
  51. ext=str.substring(pos,len);
  52. return ext;
  53. }
  54. function ReturnFileNo(obj){
  55. var filename,str,exp;
  56. if(obj.no.value!='')
  57. {
  58. return '';
  59. }
  60. str=obj.file.value;
  61. if(str.indexOf("\\")>=0)
  62. {
  63. exp="\\";
  64. }
  65. else
  66. {
  67. exp="/";
  68. }
  69. filename=ExpStr(str,exp);
  70. obj.no.value=filename;
  71. }
  72. </script>
  73. </head>
  74. <body scroll="no" style="overflow: hidden" topmargin="0">
  75. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" id="tranpictb">
  76. <form id="TranImgFormT" name="TranImgFormT" method="post" target="eeditoruploadimg<?=$ecms_topager['InstanceId']?>" enctype="multipart/form-data" action="../../../DoInfo/ecms.php" onsubmit="return DoCheckTranFile(document.TranImgFormT);">
  77. <input type=hidden name=classid value="<?=$ecms_topager['classid']?>">
  78. <input type=hidden name=filepass value="<?=$ecms_topager['filepass']?>">
  79. <input type=hidden name=infoid value="<?=$ecms_topager['infoid']?>">
  80. <input type=hidden name=enews value="MEditorTranFile">
  81. <input type=hidden name=type value="1">
  82. <input type=hidden name=doing value="0">
  83. <input type=hidden name=tranfrom value="1">
  84. <input type=hidden name=InstanceName value="<?=$ecms_topager['InstanceName']?>">
  85. <input type=hidden name=InstanceId value="<?=$ecms_topager['InstanceId']?>">
  86. <input type=hidden name=doecmspage id=doecmspage value="<?=$doecmspage?>">
  87. <tr>
  88. <td><strong>本地上传</strong><br>
  89. <input type="file" name="file" id="txtUploadFile" style="width: 100%"> </td>
  90. </tr>
  91. <tr>
  92. <td height="30">
  93. <input type="submit" name="Submit2" value="上 传"> </td>
  94. </tr>
  95. </form>
  96. </table>
  97. <iframe name="eeditoruploadimg<?=$ecms_topager['InstanceId']?>" id="eeditoruploadimg<?=$ecms_topager['InstanceId']?>" style="display:none" src="images/blank.html"></iframe>
  98. </body>
  99. </html>