eWebEditor首页 >> eWebEditor帮助文档 V15.2 >> 开发手册 >> 代码实例

3.10.5 上传文件接口

此例演示了如何使用上传文件接口参数,参数包括:originalfile, savefilename, savepathfilename

此例打包在系统的压缩包例子目录中: example/parafile.asp(.php/.aspx/.jsp)

<HTML>

<HEAD>

<TITLE>eWebEditor : 上传文件接口示例</TITLE>

<META http-equiv=Content-Type content="text/html; charset=gb2312">

<style>

body,td,input,textarea {font-size:8pt; font-family:Verdana, Arial, Helvetica}

</style>

</HEAD>

<BODY>

 

<p><b>Navigator : <a href="default.asp">Home</a> &gt; 上传文件接口示例</b></p>

<p>通过使用这个接口功能,您可以获取到所有通过编辑器上传的图片或文件的文件名及路径。</p>

<p>在编辑器中上传一个文件或图片,看一下效果。</p>

 

<Script Language=JavaScript>

function doChange(objText, objDrop){

     if (!objDrop) return;

     var str = objText.value;

     var arr = str.split("|");

     objDrop.length=0;

     for (var i=0; i<arr.length; i++){

         objDrop.options[i] = new Option(arr[i], arr[i]);

     }

}

</Script>

 

<FORM method="post" name="myform" action="retrieve.asp">

<TABLE border="0" cellpadding="2" cellspacing="1">

<TR>

     <TD>Content:</TD>

     <TD>

         <INPUT type="hidden" name="content1" value="">

         <IFRAME ID="eWebEditor1" src="../ewebeditor.htm?id=content1&style=coolblue&originalfilename=myText1&savefilename=myText2&savepathfilename=myText3" frameborder="0" scrolling="no" width="550" height="350"></IFRAME>

     </TD>

</TR>

<TR>

     <TD>parameter:originalfilename</TD>

     <TD><input type=text id=myText1 style="width:200px" onchange="doChange(this,myDrop1)">&nbsp;<select id=myDrop1 size=1 style="width:200px"></select></TD>

</TR>

<TR>

     <TD>parameter:savefilename</TD>

     <TD><input type=text id=myText2 style="width:200px" onchange="doChange(this,myDrop2)">&nbsp;<select id=myDrop2 size=1 style="width:200px"></select></TD>

</TR>

<TR>

     <TD>parameter:savepathfilename</TD>

     <TD><input type=text id=myText3 style="width:200px" onchange="doChange(this,myDrop3)">&nbsp;<select id=myDrop3 size=1 style="width:350px"></select></TD>

</TR>

<TR>

     <TD colspan=2 align=right>

     <INPUT type=submit value="Submit">

     <INPUT type=reset value="Reset">

     <INPUT type=button value="View Source" onclick="location.replace('view-source:'+location)">

     </TD>

</TR>

</TABLE>

</FORM>

 

</BODY>

</HTML>