|
蓝森林 http://www.lslnet.com 2006年8月25日 8:28
[ASP]如何实现ASP保存远程图片到本地目录?
如何实现ASP保存远程图片到本地目录呢?
我只要把这个代码就可以加到 新闻系统里了,这样很方便了。
我现在使用eWebEditor V2.80修正版,付费的需要500块才有较好的功能。
而且这个试用版也比较乱,无法获得表单的内容。
提交页代码:
<HTML>
<HEAD>
<TITLE>eWebEditor在线编辑器 - 使用例子</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<style>
body,td,input,textarea {font-size:9pt}
</style>
</HEAD>
<BODY>
<script language=JavaScript>
// 表单提交检测
function doCheck(){
// 检测表单的有效性
// 如:标题不能为空,内容不能为空,等等....
if (eWebEditor1.getHTML()=="") {
alert("内容不能为空!");
return false;
}
// 表单有效性检测完后,自动上传远程文件
// 函数:remoteUpload(strEventUploadAfter)
// 参数:strEventUploadAfter ; 上传完后,触发的函数名,如果上传完后不需动作可不填参数
eWebEditor1.remoteUpload("doSubmit()");
// 当一个表单中有多个编辑区时,你可以指定上传某个编辑区,如:
// eWebEditor1.remoteUpload();
// eWebEditor2.remoteUpload();
// eWebEditor4.remoteUpload("doSubmit()"); 这是最后一个,执行完后提交表单
return false;
}
// 表单提交(当远程上传完成后,触发此函数)
function doSubmit(){
document.myform1.submit();
}
</script>
<p><b>eWebEditor 远程文件上传示例:</b></p>
<FORM method="POST" name="myform1" action="submit.asp" onsubmit="return doCheck();">
<TABLE border="0" cellpadding="2" cellspacing="1">
<TR>
<TD rowspan="2">编辑内容:</TD>
<TD>
<INPUT type="hidden" name="content1" value="<P><IMG src="[img]http://ewebeditor.webasp.net/images/ewebeditor.gif[/img]" border=0></P><P>以上图片地址为:<A href="[img]http://ewebeditor.webasp.net/images/ewebeditor.gif">http://ewebeditor.webasp.net/images/ewebeditor.gif[/img]</A></P><P>1。点击<IMG src="[img]http://ewebeditor.webasp.net/ewebeditor/buttonimage/standard/remoteupload.gif[/img]" border=0>按钮,然后转到“代码”状态看一下,以上图片的地址已经到本地服务器了;</P><P>2。或点此表单的“提交”,提交后查看源文件看一下,图片的地址也到本地服务器了;</P><P>要看其使用说明,请见压缩包中,example/test2.asp 中的注释。</P>">
<IFRAME ID="eWebEditor1" src="editor/ewebeditor.asp?id=content1&style=s_exampleremote" frameborder="0" scrolling="no" width="550" height="350"></IFRAME>
</TD>
</TR>
<TR>
<TD>
<input type="text" name="title" size="45"></TD>
</TR>
<TR>
<TD colspan=2 align=right>
<INPUT type=submit name=b1 value="提交">
<INPUT type=reset name=b2 value="重填">
<INPUT type=button name=b3 value="查看源文件" onclick="location.replace('view-source:'+location)">
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
获取内容的代码:
<%
' 如果编辑的内容很多,上传速度太慢,请设置以下的时间,单位秒
'Server.ScriptTimeout = 600
Dim sContent1, i
For i = 1 To Request.Form("content1").Count
sContent1 = sContent1 & Request.Form("content1")(i)
Next
Response.Write "编辑内容如下:<br><br>" & sContent1
Response.Write "<br><br><p><input type=button value=' 退回 ' onclick='history.back()'></p>"
'这里获得如何获得title的值呢?
%>
————————————————————————————————————————
大家有没有更好的,希望能获得大家的帮助,感谢! |
判断提交的内容是否有带<img.+?>如果有的话就获取<img.+?>里面的地址进行保存再从命名!
你自己搜索一下,网站很多这样的教材! |
http://bbs.blueidea.com/viewthread.php?tid=1173060
|
|