eWebEditor Home >> eWebEditor Manual V11.2 >> Developer Guide >> Code Examples

3.10.3 Remote FilesAuto-uploading

This example demonstrates how to use Client API provided by eWebEditor to realize automatic uploading of remote files.

To use this code normally, please set the path of "ewebeditor.htm" to eWebEditor's actual saving path.

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

 

<HTML>

<HEAD>

<TITLE>eWebEditor : Demo of Remote Files Auto-uploading</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 Remote Files Auto-uploading</b></p>

<p>demo instructions for operation</p>

<ul>

<li>the image address in the editing area is http://www.ewebeditor.com/images/ewebeditor.gif

<li>click on this button<img src="../buttonimage/blue/remoteupload.gif"> then jump to "code" mode to see if the image address in the editing area has been transferred into local server

<li>or click on "submit" of this form. After submitting, you can check in IE "view source files" to see if the image address has been transferred into local server.

</ul>

 

 

<script language=javascript>

// form submitted for examination

function doCheck(){

 

       // examine the validity of form

       // such the title cannot be empty, the contents cannot be empty, etc

       if (eWebEditor1.getHTML()=="") {

              alert("the contents cannot be empty!");

              return false;

       }

 

       // after form validity examination, upload remote files automatically

       // function: remoteUpload(strEventUploadAfter)

       // parameter: strEventUploadAfter ; the function name is activated by completing uploads. If you need no action after uploading, you may leave this function unfilled

       eWebEditor1.remoteUpload("doSubmit()");

       return false;

 

}

 

// form submitted (after finishing uploading, this function will be activated)

function doSubmit(){

       document.myform1.submit();

}

</script>

 

 

<FORM method="post" name="myform" action="retrieve.asp" onsubmit="return doCheck();">

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

<TR>

       <TD>Content:</TD>

       <TD>

              <INPUT type="hidden" name="content1" value="&lt;IMG src=&quot;http://www.ewebeditor.com/images/ewebeditor.gif&quot;&gt;">

              <IFRAME ID="eWebEditor1" src="../ewebeditor.htm?id=content1&style=full" frameborder="0" scrolling="no" width="550" height="400"></IFRAME>

       </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>