eWebEditor Home >> eWebEditor Manual V8.0 >> Developer Guide >> Code Examples

3.10.5 Upload Files API

This example demonstrates how to use API parameters of uploaded files which include originalfile, savefilename and savepathfilename.

This example is packed in the example directory of _example/para_file.asp(.php/.aspx/.jsp) in compressed system package.

 

<HTML>

<HEAD>

<TITLE>eWebEditor : Demo of Uploaded Files' API</TITLE>

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

<link rel='stylesheet' type='text/css' href='example.css'>

</HEAD>

<BODY>

 

<p><b>Navigator : <a href="default.asp">Home</a> &gt; Demo of Uploaded Files' API</b></p>

<p>Using this API function, you can get all file names and paths of the images and files uploaded by the editor.</p>

<p>Upload a file or an image in the editor to view the effect.</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>